Skip to content

Commit

Permalink
Merge pull request #251 from gounthar/track-alpine-linux-base-version
Browse files Browse the repository at this point in the history
chore(alpine): Tracks alpine linux base version
  • Loading branch information
dduportal committed Jun 8, 2023
2 parents c4c283d + 94c1fb3 commit 2d6cc1c
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions updatecli/updatecli.d/alpine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
name: Bump Alpine version

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
latestVersion:
kind: githubrelease
name: "Get the latest Alpine Linux version"
spec:
owner: "alpinelinux"
repository: "aports" # Its release process follows Alpine's
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionfilter:
kind: semver
pattern: "~3"
transformers:
- trimprefix: "v"

conditions:
testDockerfileArg:
name: "Does the Dockerfile have an ARG instruction for the Alpine Linux version?"
kind: dockerfile
disablesourceinput: true
spec:
file: alpine/Dockerfile
instruction:
keyword: "ARG"
matcher: "ALPINE_TAG"
testDockerImageExists:
name: "Does the Docker Image exist on the Docker Hub?"
kind: dockerimage
sourceid: latestVersion
spec:
image: "alpine"
# tag come from the source
architecture: amd64
testVersionInBakeFile:
name: "Does the bake file have variable ALPINE_VERSION"
kind: file
disablesourceinput: true
spec:
file: docker-bake.hcl
matchpattern: "(.*ALPINE_FULL_TAG.*)"

targets:
updateDockerfile:
name: "Update the value of the base image (ARG ALPINE_TAG) in the Dockerfile"
kind: dockerfile
spec:
file: alpine/Dockerfile
instruction:
keyword: "ARG"
matcher: "ALPINE_TAG"
scmid: default
updateDockerBake:
name: "Update the value of the base image (ARG ALPINE_TAG) in the docker-bake.hcl"
kind: file
spec:
file: docker-bake.hcl
matchpattern: >-
variable(.*)"ALPINE_FULL_TAG"(.*){(.*)(\r\n|\r|\n)(.*)default(.*)=(.*)
replacepattern: >-
variable${1}"ALPINE_FULL_TAG"${2}{${3}${4}${5}default${6}= "{{ source "latestVersion" }}"
scmid: default
actions:
default:
kind: github/pullrequest
scmid: default
title: Bump Alpine Linux Version to {{ source "latestVersion" }}
spec:
labels:
- dependencies

0 comments on commit 2d6cc1c

Please sign in to comment.