File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed
Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ pipeline {
2+ agent any
3+ tools {
4+ go ' go-1.17'
5+ }
6+ environment {
7+ GO111MODULE = ' on'
8+ }
9+ stages {
10+ stage(' Build' ) {
11+ steps {
12+ // Get some code from a GitHub repository
13+
14+ // git branch: 'zkrollup',
15+ // credentialsId: 'testgitchuhan1',
16+ // url: '[email protected] :scroll-tech/go-ethereum.git' 17+
18+ // Build the app.
19+ sh ' go build'
20+
21+ }
22+
23+ }
24+ stage(' Test' ) {
25+ // Use golang.
26+ steps {
27+ // Remove cached test results.
28+ sh ' go clean -cache'
29+ // Run Unit Tests.
30+ sh ' make test'
31+ }
32+ }
33+
34+ stage(' Docker' ) {
35+ environment {
36+ // Extract the username and password of our credentials into "DOCKER_CREDENTIALS_USR" and "DOCKER_CREDENTIALS_PSW".
37+ // (NOTE 1: DOCKER_CREDENTIALS will be set to "your_username:your_password".)
38+ // The new variables will always be YOUR_VARIABLE_NAME + _USR and _PSW.
39+ // (NOTE 2: You can't print credentials in the pipeline for security reasons.)
40+ DOCKER_CREDENTIALS = credentials(' dockerhub' )
41+ }
42+
43+ steps {
44+ // Use a scripted pipeline.
45+ script {
46+ node {
47+ def app
48+ // stage('Initialize') {
49+ // def dockerHome = tool 'myDocker'
50+ // env.PATH = "${dockerHome}/bin:${env.PATH}"
51+ // }
52+
53+ stage(' Build image' ) {
54+ app = docker. build(" ${ env.DOCKER_CREDENTIALS_USR} /l2geth-img" )
55+ }
56+
57+ stage(' Push image' ) {
58+ // Use the Credential ID of the Docker Hub Credentials we added to Jenkins.
59+ docker. withRegistry(' https://registry.hub.docker.com' , ' dockerhub' ) {
60+ // Push image and tag it with our build number for versioning purposes.
61+ app. push(" ${ env.BUILD_NUMBER} " )
62+
63+ // Push the same image and tag it as the latest version (appears at the top of our version list).
64+ app. push(" latest" )
65+ }
66+ }
67+ }
68+ }
69+ }
70+ }
71+ }
72+ }
You can’t perform that action at this time.
0 commit comments