Skip to content

Commit 26d049f

Browse files
committed
[CI] Extract Jenkins CLI jar from jenkins.war
INFINIOPS-296 What: Get jenkins-cli.jar from the bundled jenkins.war instead of downloading it from repo.jenkins-ci.org. How: Unzip WEB-INF/lib/cli-${JENKINS_VERSION}.jar out of jenkins.war into /opt/jenkins-cli and clean up /tmp. Why: The previously working repo.jenkins-ci.org URL now returns HTTP 403, breaking the Jenkins image build. Signed-off-by: Benny Itkin <bitkin@nvidia.com>
1 parent 9da654a commit 26d049f

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/Dockerfile.jenkins

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl python3 py
1010
&& rm -rf /var/lib/apt/lists/* \
1111
&& mkdir -p /opt/jenkins-cli \
1212
&& JENKINS_VERSION=$(/opt/java/openjdk/bin/java -jar /usr/share/jenkins/jenkins.war --version) \
13-
&& curl -fsSL "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/cli/${JENKINS_VERSION}/cli-${JENKINS_VERSION}.jar" -o /opt/jenkins-cli/jenkins-cli.jar \
13+
&& unzip /usr/share/jenkins/jenkins.war WEB-INF/lib/cli-${JENKINS_VERSION}.jar -d /tmp \
14+
&& mv /tmp/WEB-INF/lib/cli-${JENKINS_VERSION}.jar /opt/jenkins-cli/jenkins-cli.jar \
15+
&& rm -rf /tmp/WEB-INF/ \
1416
&& chmod 0644 /opt/jenkins-cli/jenkins-cli.jar \
1517
&& mkdir -p /opt/docker-bin \
1618
&& arch="${TARGETARCH:-}" \

scripts/local_gha_ci.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ jenkins_script() {
296296
save_jenkins_artifacts() {
297297
local prefix="$1"
298298
local build_number
299-
build_number=$(docker exec "${JENKINS_NAME}" sh -lc "curl -sf http://localhost:8080/job/ci-demo/lastBuild/api/json" 2>/dev/null \
300-
| sed -n 's/.*"number":[[:space:]]*\([0-9][0-9]*\).*/\1/p' | head -n1 || true)
299+
build_number=$(docker exec "${JENKINS_NAME}" sh -lc "curl -sf 'http://localhost:8080/job/ci-demo/lastBuild/api/json?tree=number'" 2>/dev/null \
300+
| grep -o '"number":[[:space:]]*[0-9][0-9]*' | grep -o '[0-9][0-9]*' | head -n1 || true)
301301

302302
if [[ -n "${build_number}" ]]; then
303303
docker exec "${JENKINS_NAME}" sh -lc "curl -sf http://localhost:8080/job/ci-demo/${build_number}/consoleText" > "${LOG_DIR}/${prefix}.jenkins-console.log" 2>/dev/null || true
@@ -636,7 +636,7 @@ for conf in "${conf_files[@]}"; do
636636
fail_count=$((fail_count + 1))
637637
else
638638
echo "PASS ${conf_rel} TARGET_ARCH=${target_arch}"
639-
if ! assert_stage_order "${conf}" "${LOG_DIR}/${output_prefix}.jenkins-console.log" "${conf_base} TARGET_ARCH=${target_arch}"; then
639+
if ! assert_stage_order "${conf}" "${job_output_log}" "${conf_base} TARGET_ARCH=${target_arch}"; then
640640
fail_count=$((fail_count + 1))
641641
fi
642642
fi

0 commit comments

Comments
 (0)