- parameter:
name: USE_GIT_COMMIT
parameters:
- string:
name: USE_GIT_COMMIT
description: Git commit hash to build
- builder:
name: checkout-scripts
builders:
- shell: |
rm -fr freebsd-ci
git clone --depth=1 --single-branch -b main https://github.com/freebsd/freebsd-ci.git
cd freebsd-ci; git rev-parse HEAD; cd ..
- builder:
name: execute-job-build-script
builders:
- shell: |
sh -ex freebsd-ci/jobs/${{JOB_NAME}}/build.sh
- builder:
name: add-svn-revision-description
builders:
- system-groovy:
command: "build.setDescription(build.envVars.containsKey('GIT_COMMIT') ? build.envVars.GIT_COMMIT : 'r' + build.envVars.SVN_REVISION)"
- publisher:
name: scan-clang-warnings
publishers:
- warnings:
console-log-parsers:
- Clang (LLVM based)
- publisher:
name: scan-gcc-warnings
publishers:
- warnings:
console-log-parsers:
- GNU Make + GNU C Compiler (gcc)
- publisher:
name: publish-junit-results
publishers:
- junit:
results: test-report.xml
- publisher:
name: publish-checkstyle-results
publishers:
- checkstyle:
pattern: checkstyle-result.xml
- publisher:
name: publish-clang-scan-build-results
publishers:
- scan-build
- wrapper:
name: bind-artifact-credential
wrappers:
- credentials-binding:
- username-password-separated:
credential-id: artifact-credential
username: ARTIFACT_CRED_USER
password: ARTIFACT_CRED_PASS
- publisher:
name: make-symlink
publishers:
- postbuildscript:
mark-unstable-if-failed: true
builders:
- build-on:
- SUCCESS
build-steps:
- shell: ./freebsd-ci/artifact/post-link.py
- wrapper:
name: use-latest-testvm-revision
wrappers:
- pre-scm-buildstep:
failOnError: true
buildsteps:
- shell: |
if [ -z "${{USE_GIT_COMMIT}}" ]; then
ARTIFACT_SERVER=artifact.ci.freebsd.org
ARTIFACT_SUBDIR=snapshot/${{FBSD_BRANCH}}/latest_testvm/${{FBSD_TARGET}}/${{FBSD_TARGET_ARCH}}
USE_GIT_COMMIT=$(curl -s https://${{ARTIFACT_SERVER}}/${{ARTIFACT_SUBDIR}}/revision.txt)
fi
if [ -z "${{USE_GIT_COMMIT}}" ]; then
# Backup method -- interrogate Jenkins directly.
# Assumes description is set to the commit hash.
USE_GIT_COMMIT=$(curl -s ${{JENKINS_URL}}/job/FreeBSD-${{FBSD_BRANCH}}-${{FBSD_TARGET_ARCH}}-testvm/lastSuccessfulBuild/api/json | jq '.description')
fi
rm -f ${{WORKSPACE}}/use_git_commit.property
echo "USE_GIT_COMMIT=${{USE_GIT_COMMIT}}" > ${{WORKSPACE}}/use_git_commit.property
- inject:
properties-file: "${{WORKSPACE}}/use_git_commit.property"