Skip to content

Commit

Permalink
Enable publishing on trusted (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Sep 9, 2021
1 parent a823a18 commit dcb0f58
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
47 changes: 31 additions & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/* NOTE: this Pipeline mainly aims at catching mistakes (wrongly formed Dockerfile, etc.)
* This Pipeline is *not* used for actual image publishing.
* This is currently handled through Automated Builds using standard Docker Hub feature
*/
pipeline {
agent none

Expand Down Expand Up @@ -58,21 +54,40 @@ pipeline {
}
steps {
script {
if(!infra.isTrusted()) {
deleteDir()
checkout scm
sh '''
make build
make test
'''
infra.withDockerCredentials {
def branchName = "${env.BRANCH_NAME}"
if (infra.isTrusted()) {
if (branchName ==~ 'master') {
sh '''
docker buildx create --use
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx bake --push --file docker-bake.hcl linux
'''
} else if (env.TAG_NAME != null) {
sh """
export ON_TAG=true
export VERSION=$TAG_NAME
docker buildx create --use
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx bake --push --file docker-bake.hcl linux
"""
}
} else {
sh 'make build'
try {
sh 'make test'
} finally {
junit('target/*.xml')
}
sh '''
docker buildx create --use
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx bake --file docker-bake.hcl linux
'''
}
}
}
}
post {
always {
junit('target/*.xml')
}
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,12 @@ DOCKER_PLUGIN_DEFAULT_ARG="/usr/sbin/sshd -D -p 22"

clean_test_container "${test_container_name}"
}

@test "[${SUT_IMAGE}] has utf-8 locale" {
if [[ "${SUT_IMAGE}" == *"alpine"* ]]; then
run docker run --entrypoint sh --rm "${SUT_IMAGE}" -c '/usr/glibc-compat/bin/locale charmap'
else
run docker run --entrypoint sh --rm "${SUT_IMAGE}" -c 'locale charmap'
fi
assert_equal "${output}" "UTF-8"
}

0 comments on commit dcb0f58

Please sign in to comment.