Skip to content

Commit

Permalink
Merge pull request #2109 from vvbandeira/ci-dev
Browse files Browse the repository at this point in the history
CI dev
  • Loading branch information
vvbandeira authored Jul 6, 2024
2 parents b95ac8b + 74bf492 commit 5449b9e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 12 deletions.
34 changes: 26 additions & 8 deletions etc/DockerHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ usage: $0 [CMD] [OPTIONS]
'dev': os + packages to compile app
'builder': os + packages to compile app +
copy source code and build app
-threads Max number of threads to use if compiling.
-threads=N Max number of threads to use if compiling.
Default = \$(nproc)
-tag Use as the image tag. Default is git commit sha
-tag=TAG Use as the image tag. Default is git commit sha.
-username=USERNAME Username to loging at the docker registry.
-password=PASSWORD Password to loging at the docker registry.
-ci Install CI tools in image
-dry-run Do not push images to the repository
-h -help Show this message and exits
-username Docker Username
-password Docker Password
EOF
exit "${1:-1}"
Expand Down Expand Up @@ -102,7 +103,11 @@ _push() {
_help
fi

${DOCKER_CMD} login --username "${username}" --password "${password}"
if [[ "${dryRun}" == 1 ]]; then
echo "Skipping docker login"
else
${DOCKER_CMD} login --username "${username}" --password "${password}"
fi

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

${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
if [[ "${dryRun}" != 1 ]]; then
${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
fi
fi

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

${DOCKER_CMD} tag ${org}/flow-${os}-builder:${imageTag} ${org}/orfs:${tag}
${DOCKER_CMD} push ${org}/orfs:${tag}
builderTag=${org}/flow-${os}-builder:${imageTag}
orfsTag=${org}/orfs:${tag}
echo "Renaming docker image: ${builderTag} -> ${orfsTag}"
${DOCKER_CMD} tag ${builderTag} ${orfsTag}
if [[ "${dryRun}" == 1 ]]; then
echo "[DRY-RUN] ${DOCKER_CMD} push ${orfsTag}"
else
${DOCKER_CMD} push ${orfsTag}
fi
fi
}

Expand Down Expand Up @@ -157,6 +171,7 @@ target="dev"
numThreads="-1"
tag=""
options=""
dryRun=0

while [ "$#" -gt 0 ]; do
case "${1}" in
Expand All @@ -166,6 +181,9 @@ while [ "$#" -gt 0 ]; do
-ci )
options="-ci"
;;
-dry-run )
dryRun=1
;;
-os=* )
os="${1#*=}"
;;
Expand Down
27 changes: 23 additions & 4 deletions jenkins/public_tests_all.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
@Library('utils@orfs-v2.0.1') _
@Library('utils@orfs-v2.1.0') _

node('ubuntu22') {
node {

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

stage('Checkout') {
checkout scm;
checkout([
$class: 'GitSCM',
branches: [[name: scm.branches[0].name]],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'CloneOption', noTags: false],
[$class: 'SubmoduleOption', recursiveSubmodules: true]
],
submoduleCfg: [],
userRemoteConfigs: scm.userRemoteConfigs
]);
def description = sh(script: "git log -1 --pretty=%B", returnStdout: true).trim();
if (description.contains('ci') && description.contains('skip')) {
currentBuild.result = 'SKIPPED'; // 'SUCCESS', 'SKIPPED'
return;
}
}

def DOCKER_IMAGE;
Expand All @@ -19,7 +34,11 @@ node('ubuntu22') {
}

stage('Run Tests') {
runTests(DOCKER_IMAGE, 'pr');
if (env.CHANGE_BRANCH && env.CHANGE_BRANCH.contains('ci-dev')) {
runTests(DOCKER_IMAGE, 'dev');
} else {
runTests(DOCKER_IMAGE, 'pr');
}
}

stage ('Cleanup and Reporting') {
Expand Down

0 comments on commit 5449b9e

Please sign in to comment.