Skip to content

Commit 5449b9e

Browse files
authored
Merge pull request #2109 from vvbandeira/ci-dev
CI dev
2 parents b95ac8b + 74bf492 commit 5449b9e

File tree

2 files changed

+49
-12
lines changed

2 files changed

+49
-12
lines changed

etc/DockerHelper.sh

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ usage: $0 [CMD] [OPTIONS]
2525
'dev': os + packages to compile app
2626
'builder': os + packages to compile app +
2727
copy source code and build app
28-
-threads Max number of threads to use if compiling.
28+
-threads=N Max number of threads to use if compiling.
2929
Default = \$(nproc)
30-
-tag Use as the image tag. Default is git commit sha
30+
-tag=TAG Use as the image tag. Default is git commit sha.
31+
-username=USERNAME Username to loging at the docker registry.
32+
-password=PASSWORD Password to loging at the docker registry.
3133
-ci Install CI tools in image
34+
-dry-run Do not push images to the repository
3235
-h -help Show this message and exits
33-
-username Docker Username
34-
-password Docker Password
3536
3637
EOF
3738
exit "${1:-1}"
@@ -102,7 +103,11 @@ _push() {
102103
_help
103104
fi
104105

105-
${DOCKER_CMD} login --username "${username}" --password "${password}"
106+
if [[ "${dryRun}" == 1 ]]; then
107+
echo "Skipping docker login"
108+
else
109+
${DOCKER_CMD} login --username "${username}" --password "${password}"
110+
fi
106111

107112
if [[ "${tag}" == "" ]]; then
108113
tag=$(./etc/DockerTag.sh -dev)
@@ -114,7 +119,9 @@ _push() {
114119
./etc/DockerHelper.sh create -os=${os} -target=dev -tag=${tag} -ci \
115120
2>&1 | tee build/create-${os}-dev-${tag}.log
116121

117-
${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
122+
if [[ "${dryRun}" != 1 ]]; then
123+
${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
124+
fi
118125
fi
119126

120127
if [[ "${target}" == "master" ]]; then
@@ -123,8 +130,15 @@ _push() {
123130
./etc/DockerHelper.sh create -os=${os} -target=builder \
124131
2>&1 | tee build/create-${os}-${target}-${tag}.log
125132

126-
${DOCKER_CMD} tag ${org}/flow-${os}-builder:${imageTag} ${org}/orfs:${tag}
127-
${DOCKER_CMD} push ${org}/orfs:${tag}
133+
builderTag=${org}/flow-${os}-builder:${imageTag}
134+
orfsTag=${org}/orfs:${tag}
135+
echo "Renaming docker image: ${builderTag} -> ${orfsTag}"
136+
${DOCKER_CMD} tag ${builderTag} ${orfsTag}
137+
if [[ "${dryRun}" == 1 ]]; then
138+
echo "[DRY-RUN] ${DOCKER_CMD} push ${orfsTag}"
139+
else
140+
${DOCKER_CMD} push ${orfsTag}
141+
fi
128142
fi
129143
}
130144

@@ -157,6 +171,7 @@ target="dev"
157171
numThreads="-1"
158172
tag=""
159173
options=""
174+
dryRun=0
160175

161176
while [ "$#" -gt 0 ]; do
162177
case "${1}" in
@@ -166,6 +181,9 @@ while [ "$#" -gt 0 ]; do
166181
-ci )
167182
options="-ci"
168183
;;
184+
-dry-run )
185+
dryRun=1
186+
;;
169187
-os=* )
170188
os="${1#*=}"
171189
;;

jenkins/public_tests_all.Jenkinsfile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1-
@Library('utils@orfs-v2.0.1') _
1+
@Library('utils@orfs-v2.1.0') _
22

3-
node('ubuntu22') {
3+
node {
44

55
properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME)]);
66

77
stage('Checkout') {
8-
checkout scm;
8+
checkout([
9+
$class: 'GitSCM',
10+
branches: [[name: scm.branches[0].name]],
11+
doGenerateSubmoduleConfigurations: false,
12+
extensions: [
13+
[$class: 'CloneOption', noTags: false],
14+
[$class: 'SubmoduleOption', recursiveSubmodules: true]
15+
],
16+
submoduleCfg: [],
17+
userRemoteConfigs: scm.userRemoteConfigs
18+
]);
19+
def description = sh(script: "git log -1 --pretty=%B", returnStdout: true).trim();
20+
if (description.contains('ci') && description.contains('skip')) {
21+
currentBuild.result = 'SKIPPED'; // 'SUCCESS', 'SKIPPED'
22+
return;
23+
}
924
}
1025

1126
def DOCKER_IMAGE;
@@ -19,7 +34,11 @@ node('ubuntu22') {
1934
}
2035

2136
stage('Run Tests') {
22-
runTests(DOCKER_IMAGE, 'pr');
37+
if (env.CHANGE_BRANCH && env.CHANGE_BRANCH.contains('ci-dev')) {
38+
runTests(DOCKER_IMAGE, 'dev');
39+
} else {
40+
runTests(DOCKER_IMAGE, 'pr');
41+
}
2342
}
2443

2544
stage ('Cleanup and Reporting') {

0 commit comments

Comments
 (0)