-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjenkinsfile.txt
More file actions
40 lines (36 loc) · 1022 Bytes
/
Copy pathjenkinsfile.txt
File metadata and controls
40 lines (36 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pipeline {
agent any
environment {
PROJECT_NAME="Jenkins pipeline for simple crud app "
OWNER_NAME="wannabelll"
GOPATH = "${env.WORKSPACE}/go"
GOCACHE = "${env.WORKSPACE}/.cache/go-build"
PATH = "${PATH}:/usr/local/go/bin"
}
stages {
stage('Checkout') {
steps {
git branch: 'main', credentialsId: 'ssh-private-key-v1.0', url: 'git@github.com:wannabelll/crud-api_GO.git'
sh 'whoami '
sh 'echo $OWNER_NAME'
sh 'date'
}
}
stage('Setup Go') {
steps {
sh 'mkdir -p $GOPATH/src $GOPATH/bin $GOPATH/pkg'
sh 'mkdir -p $GOCACHE' // Ensure the cache directory exists
}
}
stage('Build') {
steps {
sh 'go build -o myapp .'
}
}
stage('Test') {
steps {
sh 'go test ./...'
}
}
}
}