Initial commit
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 906 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 706 KiB |
BIN
exercises/12-basic-jenkinsfile/solution/images/go-plugin.png
Normal file
BIN
exercises/12-basic-jenkinsfile/solution/images/go-plugin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 864 KiB |
BIN
exercises/12-basic-jenkinsfile/solution/images/job-scm.png
Normal file
BIN
exercises/12-basic-jenkinsfile/solution/images/job-scm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 760 KiB |
BIN
exercises/12-basic-jenkinsfile/solution/images/new-job.png
Normal file
BIN
exercises/12-basic-jenkinsfile/solution/images/new-job.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 902 KiB |
54
exercises/12-basic-jenkinsfile/solution/solution.md
Normal file
54
exercises/12-basic-jenkinsfile/solution/solution.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Solution
|
||||
|
||||
Create a new job.
|
||||
|
||||

|
||||
|
||||
Configure the appropriate SCM.
|
||||
|
||||

|
||||
|
||||
Install the Go plugin.
|
||||
|
||||

|
||||
|
||||
Configure a Go runtime as global tool.
|
||||
|
||||

|
||||
|
||||
The `main.go` file could similar to the one below.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello world")
|
||||
}
|
||||
```
|
||||
|
||||
The final `Jenkinsfile` looks similar to the solution below.
|
||||
|
||||
```groovy
|
||||
pipeline {
|
||||
agent any
|
||||
tools {
|
||||
go 'go-1.12'
|
||||
}
|
||||
environment {
|
||||
GO111MODULE = 'on'
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'go build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A build of the job installs the Go runtime and executes the build step.
|
||||
|
||||

|
||||
Reference in New Issue
Block a user