Skip to content

Commit 864b2ca

Browse files
committed
Retrieve syft image tag from jenkins env vars, default to latest
1 parent 09059fd commit 864b2ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ansible/roles/repository/templates/Jenkinsfile.j2

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ pipeline {
8080
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
8181
env.PULL_REQUEST = env.CHANGE_ID
8282
env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md{% if project_deprecation_status != true %} ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml{% if custom_external_trigger != true %} ./.github/workflows/external_trigger.yml{% endif %}{% endif %}{% if sponsor_links is defined %} ./root/donate.txt{% endif %}{% if project_deprecation_status %} ./root/etc/s6-overlay/s6-rc.d/init-deprecate/run ./root/etc/s6-overlay/s6-rc.d/init-deprecate/up ./root/etc/s6-overlay/s6-rc.d/init-deprecate/type ./root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d/init-config-end ./root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d/init-deprecate ./root/etc/s6-overlay/s6-rc.d/user/contents.d/init-deprecate{% endif %}'
83+
if ( env.SYFT_IMAGE_TAG == null ) {
84+
env.SYFT_IMAGE_TAG = 'latest'
85+
}
8386
}
87+
echo "Using syft image tag ${SYFT_IMAGE_TAG}"
8488
sh '''#! /bin/bash
8589
echo "The default github branch detected as ${GH_DEFAULT_BRANCH}" '''
8690
script{
@@ -1082,7 +1086,7 @@ pipeline {
10821086
docker run --rm \
10831087
-v /var/run/docker.sock:/var/run/docker.sock:ro \
10841088
-v ${TEMPDIR}:/tmp \
1085-
ghcr.io/anchore/syft:latest \
1089+
ghcr.io/anchore/syft:${SYFT_IMAGE_TAG} \
10861090
${LOCAL_CONTAINER} -o table=/tmp/package_versions.txt
10871091
NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
10881092
echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github"
@@ -1210,6 +1214,7 @@ pipeline {
12101214
-e WEB_AUTH=\"${CI_AUTH}\" \
12111215
-e WEB_PATH=\"${CI_WEBPATH}\" \
12121216
-e NODE_NAME=\"${NODE_NAME}\" \
1217+
-e SYFT_IMAGE_TAG=\"${SYFT_IMAGE_TAG}\" \
12131218
-t ghcr.io/linuxserver/ci:latest \
12141219
python3 test_build.py'''
12151220
}

0 commit comments

Comments
 (0)