diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1825becc..a350a4d1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -40,6 +40,11 @@ updates: open-pull-requests-limit: 10 - package-ecosystem: docker directory: "./dockerfiles/sidekick" + schedule: + interval: weekly + open-pull-requests-limit: 10 + - package-ecosystem: docker + directory: "./dockerfiles/agent-discovery" schedule: interval: weekly open-pull-requests-limit: 10 @@ -52,4 +57,4 @@ updates: directory: "./dockerfiles/golang" schedule: interval: weekly - open-pull-requests-limit: 10 \ No newline at end of file + open-pull-requests-limit: 10 diff --git a/.github/workflows/github-docker-registry-push.yml b/.github/workflows/github-docker-registry-push.yml index 8e015f0a..b4a33c91 100644 --- a/.github/workflows/github-docker-registry-push.yml +++ b/.github/workflows/github-docker-registry-push.yml @@ -91,8 +91,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ env.GHCR_USERNAME }} - password: ${{ env.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract branch name # This step extracts the branch name diff --git a/docker-compose.yaml b/docker-compose.yaml index 60ac4d43..75b0f979 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -59,7 +59,6 @@ services: - python - node - android - - multi - golang - default # The CASC_RELOAD_TOKEN environment variable is used by the Jenkins controller to restart the Configuration as Code (JCasc) plugin configuration. diff --git a/dockerfiles/agent-discovery/Dockerfile b/dockerfiles/agent-discovery/Dockerfile index be96b45c..e598541e 100644 --- a/dockerfiles/agent-discovery/Dockerfile +++ b/dockerfiles/agent-discovery/Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile is used to prepare a Debian-based Docker image with several utilities installed. # We start from the Debian 'bookworm' image dated 2023-11-20. -FROM debian:bookworm-20240311-slim as prepare-stage +FROM debian:bookworm-20241111-slim as prepare-stage # Copy all shell scripts from the current directory to /usr/local/bin/ in the image. COPY *sh /usr/local/bin/ diff --git a/dockerfiles/agent-discovery/find-name.sh b/dockerfiles/agent-discovery/find-name.sh index 7d4efb7b..0471321d 100644 --- a/dockerfiles/agent-discovery/find-name.sh +++ b/dockerfiles/agent-discovery/find-name.sh @@ -79,15 +79,31 @@ while true; do sleep 2 # Wait for 5 seconds before the next iteration of the loop. done +## Check if jenkins_controller is reachable, otherwise fall back to multi_jenkins_controller +JENKINS_CONTROLLER="jenkins_controller" +if ! curl -s -f --max-time 60 "http://${JENKINS_CONTROLLER}:8080/login" > /dev/null; then + echo "Primary controller not reachable, falling back to multi controller..." + JENKINS_CONTROLLER="multi_jenkins_controller" + if ! curl -s -f --max-time 60 "http://${JENKINS_CONTROLLER}:8080/login" > /dev/null; then + echo "Error: Neither primary nor multi controller is reachable" + exit 1 + fi +fi + # Check If Jenkins is running or not # If the message is found, awk exits with a non-zero status (1), and the loop continues. # If the message is not found, the loop exits, and the "Jenkins is running" message is displayed. -timeout 60 bash -c 'until curl -s -f http://jenkins_controller:8080/login > /dev/null; do sleep 5; done' && echo "Jenkins is running" || echo "Jenkins is not running" +timeout 60 bash -c "until curl -s -f http://${JENKINS_CONTROLLER}:8080/login > /dev/null; do sleep 5; done" && echo "Jenkins is running" || echo "Jenkins is not running" +# The colon (:) is a no-op command in Bash, which means it does nothing and always returns a true exit status. It is often used as a placeholder or to evaluate expressions without executing any commands. +# The ${JENKINS_STARTUP_TIMEOUT:=60} part is a parameter expansion. It checks if the JENKINS_STARTUP_TIMEOUT variable is set and not null. If it is not set, it assigns the value 60 to JENKINS_STARTUP_TIMEOUT +: "${JENKINS_STARTUP_TIMEOUT:=60}" # Default to 60 seconds if not set +timeout "${JENKINS_STARTUP_TIMEOUT}" bash -c "until curl -s -f http://${JENKINS_CONTROLLER}:8080/login > /dev/null; do sleep 5; done" && echo "Jenkins is running" || echo "Jenkins is not running" + echo "Jenkins is ready" # Get the Jenkins version -JENKINS_VERSION=$(curl -s -I -k http://admin:admin@jenkins_controller:8080 | grep -i '^X-Jenkins:' | awk '{print $2}') +JENKINS_VERSION=$(curl -s -I -k http://admin:admin@$JENKINS_CONTROLLER:8080 | grep -i '^X-Jenkins:' | awk '{print $2}') echo "Jenkins version is: $JENKINS_VERSION" # Use the token in the curl command to reload the configuration -# curl -X POST "http://admin:admin@jenkins_controller:8080/reload-configuration-as-code/?casc-reload-token=$JCASC_TOKEN" -curl -X POST "http://admin:admin@jenkins_controller:8080/reload-configuration-as-code/?casc-reload-token=thisisnotsecure" +# curl -X POST "http://admin:admin@$JENKINS_CONTROLLER:8080/reload-configuration-as-code/?casc-reload-token=$JCASC_TOKEN" +curl -X POST "http://admin:admin@$JENKINS_CONTROLLER:8080/reload-configuration-as-code/?casc-reload-token=thisisnotsecure" diff --git a/dockerfiles/plugins.txt b/dockerfiles/plugins.txt index 30b594e3..709d2cf6 100644 --- a/dockerfiles/plugins.txt +++ b/dockerfiles/plugins.txt @@ -78,5 +78,5 @@ workflow-job:1468.vcf4f5ee92395 workflow-multibranch:795.ve0cb_1f45ca_9a_ workflow-scm-step:427.v4ca_6512e7df1 workflow-step-api:678.v3ee58b_469476 -workflow-support:932.vb_555de1b_a_b_94 +workflow-support:936.v9fa_77211ca_e1 ws-cleanup:0.48