diff --git a/.github/workflows/updatecli.yaml b/.github/workflows/updatecli.yaml new file mode 100644 index 00000000..81bb9ab8 --- /dev/null +++ b/.github/workflows/updatecli.yaml @@ -0,0 +1,43 @@ +# This is a GitHub Actions workflow named "updatecli" +name: updatecli +on: + # This workflow can be triggered manually + workflow_dispatch: + # This workflow is scheduled to run once per week (to avoid alert fatigue) + # Specifically, it runs every Monday at 2am UTC + schedule: + - cron: '0 2 * * 1' + # This workflow is also triggered on every push event + push: + # This workflow is also triggered on every pull request event + pull_request: +jobs: + # This job is named "updatecli" + updatecli: + # This job runs on the latest version of Ubuntu + runs-on: ubuntu-latest + steps: + # This step checks out the repository using the checkout action + - name: Checkout + uses: actions/checkout@v4 + + # This step installs Updatecli in the runner using the updatecli-action + - name: Install Updatecli in the runner + uses: updatecli/updatecli-action@v2.49.0 + + # This step runs Updatecli in Dry Run mode + # It uses the "diff" command of updatecli with the specified config and values files + # The GitHub token is passed as an environment variable + - name: Run Updatecli in Dry Run mode + run: updatecli diff --config ./updatecli/updatecli.d --values ./updatecli/values.github-action.yaml + env: + UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # This step runs Updatecli in Apply mode, but only if the current branch is 'master' + # It uses the "apply" command of updatecli with the specified config and values files + # The GitHub token is passed as an environment variable + - name: Run Updatecli in Apply mode + if: github.ref == 'refs/heads/master' + run: updatecli apply --config ./updatecli/updatecli.d --values ./updatecli/values.github-action.yaml + env: + UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 95384f89..d6ebb1cf 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -31,7 +31,7 @@ services: retries: 5 default_agent: - image: jenkins/ssh-agent:5.5.0-jdk17 + image: jenkins/ssh-agent:5.5.0 container_name: desktop-jenkins_agent-1 depends_on: sidekick_service: @@ -147,7 +147,6 @@ services: volumes: - agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only - volumes: jenkins_home: agent-ssh-dir: diff --git a/dockerfiles/gitpodURL.sh b/dockerfiles/gitpodURL.sh index 4c11bb87..bcda0d6e 100755 --- a/dockerfiles/gitpodURL.sh +++ b/dockerfiles/gitpodURL.sh @@ -7,7 +7,7 @@ config_file="/workspace/quickstart-tutorials/dockerfiles/jenkins.yaml" service_url=$(echo "$GITPOD_WORKSPACE_URL" | awk -F/ '{print $3}') # Print the hostname for debugging purposes -echo "Once you enter `docker compose up , Jenkins will be accessible here: https://8080-$service_url" +echo "Once you enter `docker compose up `, Jenkins will be accessible here: https://8080-$service_url" # Use yq to update the value of the .unclassified.location.url field in the configuration file yq eval ".unclassified.location.url = \"https://8080-$service_url/\"" "$config_file" > "$config_file.tmp" && mv "$config_file.tmp" "$config_file" diff --git a/dockerfiles/multi/Dockerfile b/dockerfiles/multi/Dockerfile index 4cf28530..5358945f 100644 --- a/dockerfiles/multi/Dockerfile +++ b/dockerfiles/multi/Dockerfile @@ -1,4 +1,4 @@ -FROM jenkins/ssh-agent:5.12.0-jdk17 as ssh-agent +FROM jenkins/ssh-agent:5.20.0 as ssh-agent # ca-certificates because curl will need it later on for the Maven installation RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && apt-get clean && \ rm -rf /var/lib/apt/lists/* diff --git a/updatecli/updatecli.d/ssh-agent.yaml b/updatecli/updatecli.d/ssh-agent.yaml new file mode 100644 index 00000000..47119b19 --- /dev/null +++ b/updatecli/updatecli.d/ssh-agent.yaml @@ -0,0 +1,68 @@ +--- +name: Bump Docker image tag for "jenkins/ssh-agent" +sources: + jenkins/ssh-agent: + name: '[jenkins/ssh-agent] Get latest Docker image tag' + kind: dockerimage + spec: + image: jenkins/ssh-agent + tagfilter: ^\d*(\.\d*){2}$ + versionfilter: + kind: semver + pattern: '>=5.20.0' +targets: + jenkins/python-agent: + name: '[jenkins/ssh-agent] Bump Docker image tag in "dockerfiles/python/Dockerfile"' + kind: dockerfile + spec: + file: dockerfiles/python/Dockerfile + instruction: + keyword: FROM + matcher: jenkins/ssh-agent + sourceid: jenkins/ssh-agent + jenkins/node-agent: + name: '[jenkins/ssh-agent] Bump Docker image tag in "dockerfiles/node/Dockerfile"' + kind: dockerfile + spec: + file: dockerfiles/node/Dockerfile + instruction: + keyword: FROM + matcher: jenkins/ssh-agent + sourceid: jenkins/ssh-agent + jenkins/multibranch-agent: + name: '[jenkins/ssh-agent] Bump Docker image tag in "dockerfiles/multi/Dockerfile"' + kind: dockerfile + spec: + file: dockerfiles/multi/Dockerfile + instruction: + keyword: FROM + matcher: jenkins/ssh-agent + sourceid: jenkins/ssh-agent + jenkins/maven-agent: + name: '[jenkins/ssh-agent] Bump Docker image tag in "dockerfiles/maven/Dockerfile"' + kind: dockerfile + spec: + file: dockerfiles/maven/Dockerfile + instruction: + keyword: FROM + matcher: jenkins/ssh-agent + sourceid: jenkins/ssh-agent + default-agent: + name: '[jenkins/ssh-agent] Bump Docker image tag in "docker-compose.yaml"' + kind: yaml + transformers: + - addprefix: 'jenkins/ssh-agent:' + spec: + file: docker-compose.yaml + key: $.services.default_agent.image + sourceid: jenkins/ssh-agent + default-build-agent: + name: '[jenkins/ssh-agent] Bump Docker image tag in "build-docker-compose.yaml"' + kind: yaml + transformers: + - addprefix: 'jenkins/ssh-agent:' + spec: + file: build-docker-compose.yaml + key: $.services.default_agent.image + sourceid: jenkins/ssh-agent + diff --git a/updatecli/values.github-action.yaml b/updatecli/values.github-action.yaml new file mode 100644 index 00000000..1c059638 --- /dev/null +++ b/updatecli/values.github-action.yaml @@ -0,0 +1,8 @@ +github: + user: "GitHub Actions" + email: "41898282+github-actions[bot]@users.noreply.github.com" + username: "github-actions" + token: "UPDATECLI_GITHUB_TOKEN" + branch: "master" + owner: "jenkins-docs" + repository: "quickstart-tutorials"