Skip to content

Commit

Permalink
Merge pull request #9 from gounthar/updatecli
Browse files Browse the repository at this point in the history
Updatecli
  • Loading branch information
gounthar authored Nov 25, 2023
2 parents afe652d + f97f244 commit 20408cc
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 4 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/updatecli.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

# 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 }}
3 changes: 1 addition & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/gitpodURL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <target>, Jenkins will be accessible here: https://8080-$service_url"
echo "Once you enter `docker compose up <target>`, 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"
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/multi/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand Down
68 changes: 68 additions & 0 deletions updatecli/updatecli.d/ssh-agent.yaml
Original file line number Diff line number Diff line change
@@ -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

8 changes: 8 additions & 0 deletions updatecli/values.github-action.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 20408cc

Please sign in to comment.