Skip to content

Commit 1ecbde7

Browse files
ChuhanJinmask-ppJJVincentJJ
authored
Jenkins (ethereum#23)
* Create l2geth_ci.yml * Update l2geth_ci.yml * Update l2geth_ci.yml * jenkins file * remove extra Co-authored-by: maskpp <[email protected]> Co-authored-by: chuhanjin <[email protected]>
1 parent 59df2d7 commit 1ecbde7

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

Jenkinsfile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
}

0 commit comments

Comments
 (0)