Skip to content

Commit dcb0f58

Browse files
authored
Enable publishing on trusted (#82)
1 parent a823a18 commit dcb0f58

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

Jenkinsfile

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* NOTE: this Pipeline mainly aims at catching mistakes (wrongly formed Dockerfile, etc.)
2-
* This Pipeline is *not* used for actual image publishing.
3-
* This is currently handled through Automated Builds using standard Docker Hub feature
4-
*/
51
pipeline {
62
agent none
73

@@ -58,21 +54,40 @@ pipeline {
5854
}
5955
steps {
6056
script {
61-
if(!infra.isTrusted()) {
62-
deleteDir()
63-
checkout scm
64-
sh '''
65-
make build
66-
make test
67-
'''
57+
infra.withDockerCredentials {
58+
def branchName = "${env.BRANCH_NAME}"
59+
if (infra.isTrusted()) {
60+
if (branchName ==~ 'master') {
61+
sh '''
62+
docker buildx create --use
63+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
64+
docker buildx bake --push --file docker-bake.hcl linux
65+
'''
66+
} else if (env.TAG_NAME != null) {
67+
sh """
68+
export ON_TAG=true
69+
export VERSION=$TAG_NAME
70+
docker buildx create --use
71+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
72+
docker buildx bake --push --file docker-bake.hcl linux
73+
"""
74+
}
75+
} else {
76+
sh 'make build'
77+
try {
78+
sh 'make test'
79+
} finally {
80+
junit('target/*.xml')
81+
}
82+
sh '''
83+
docker buildx create --use
84+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
85+
docker buildx bake --file docker-bake.hcl linux
86+
'''
87+
}
6888
}
6989
}
7090
}
71-
post {
72-
always {
73-
junit('target/*.xml')
74-
}
75-
}
7691
}
7792
}
7893
}

tests/tests.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,12 @@ DOCKER_PLUGIN_DEFAULT_ARG="/usr/sbin/sshd -D -p 22"
174174

175175
clean_test_container "${test_container_name}"
176176
}
177+
178+
@test "[${SUT_IMAGE}] has utf-8 locale" {
179+
if [[ "${SUT_IMAGE}" == *"alpine"* ]]; then
180+
run docker run --entrypoint sh --rm "${SUT_IMAGE}" -c '/usr/glibc-compat/bin/locale charmap'
181+
else
182+
run docker run --entrypoint sh --rm "${SUT_IMAGE}" -c 'locale charmap'
183+
fi
184+
assert_equal "${output}" "UTF-8"
185+
}

0 commit comments

Comments
 (0)