Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions 5d1a38e8-e15a-450e-903c-562255e51faf/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
pipeline {
agent any

environment {
GO_VERSION = '1.21'
GOPATH = "${WORKSPACE}/gopath"
PATH = "${GOPATH}/bin:${PATH}"
}

stages {
stage('Clone Repository') {
steps {
git url: 'https://github.com/deepanshu-ops0/ops0-cli', branch: 'main'
}
}

stage('Setup Go Environment') {
steps {
sh 'go version'
sh 'mkdir -p ${GOPATH}/src ${GOPATH}/bin'
sh 'go env'
}
}

stage('Download Dependencies') {
steps {
sh 'go mod download'
}
}

stage('Run Tests') {
steps {
sh 'go test ./...'
}
}

stage('Build Binary') {
steps {
sh 'go build -o bin/ops0-cli'
}
}

stage('Archive Artifacts') {
steps {
archiveArtifacts artifacts: 'bin/ops0-cli', fingerprint: true
}
}
}

post {
success {
echo 'Pipeline completed successfully!'
}
failure {
echo 'Pipeline failed!'
}
always {
cleanWs()
}
}
}