Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 3rd party image deps update workflow #4223

Merged
merged 9 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/build-push-image-with-apko/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ runs:
using: "composite"
steps:
- id: check-image-exists
if: ${{ inputs.overwrite == 'false' }}
shell: bash
run: |
set -euo pipefail
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/image-deps-updater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,23 @@ jobs:
- name: Get tags
id: get-tags
run: |
minio_yaml=$(curl -s --fail --show-error https://raw.githubusercontent.com/wolfi-dev/os/main/minio.yaml)
minio_version=$(echo "$minio_yaml" | grep "version:" | awk '{print $2}' | tr -d '\n')
minio_epoch=$(echo "$minio_yaml" | grep "epoch:" | awk '{print $2}' | tr -d '\n')
set -euo pipefail

rqlite_yaml=$(curl -s --fail --show-error https://raw.githubusercontent.com/wolfi-dev/os/main/rqlite.yaml)
rqlite_version=$(echo "$rqlite_yaml" | grep "version:" | awk '{print $2}' | tr -d '\n')
rqlite_epoch=$(echo "$rqlite_yaml" | grep "epoch:" | awk '{print $2}' | tr -d '\n')
curl -LO --fail --show-error https://packages.wolfi.dev/os/x86_64/APKINDEX.tar.gz
tar -xzvf APKINDEX.tar.gz

dex_yaml=$(curl -s --fail --show-error https://raw.githubusercontent.com/wolfi-dev/os/main/dex.yaml)
dex_version=$(echo "$dex_yaml" | grep "version:" | awk '{print $2}' | tr -d '\n')
dex_epoch=$(echo "$dex_yaml" | grep "epoch:" | awk '{print $2}' | tr -d '\n')
minio_version=$(< APKINDEX grep -A1 "^P:minio$" | tail -n 1 | sed -n -e 's/V://p' | tr -d '\n')
rqlite_version=$(< APKINDEX grep -A1 "^P:rqlite$" | tail -n 1 | sed -n -e 's/V://p' | tr -d '\n')
dex_version=$(< APKINDEX grep -A1 "^P:dex$" | tail -n 1 | sed -n -e 's/V://p' | tr -d '\n')

sed "s/__MINIO_VERSION__/$minio_version/g" deploy/minio/apko.yaml.tmpl > deploy/minio/apko.yaml
sed "s/__RQLITE_VERSION__/$rqlite_version/g" deploy/rqlite/apko.yaml.tmpl > deploy/rqlite/apko.yaml
sed "s/__DEX_VERSION__/$dex_version/g" deploy/dex/apko.yaml.tmpl > deploy/dex/apko.yaml

{
echo "minio-tag=$minio_version-$minio_epoch"
echo "rqlite-tag=$rqlite_version-$rqlite_epoch"
echo "dex-tag=$dex_version-$dex_epoch"
echo "minio-tag=$minio_version"
echo "rqlite-tag=$rqlite_version"
echo "dex-tag=$dex_version"
} >> "$GITHUB_OUTPUT"

- name: Build and push minio image
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
overwrite: ${{ github.event.inputs.overwrite }}


update-image-deps:
needs: [build-3rd-party-images]
runs-on: ubuntu-20.04
Expand Down
6 changes: 3 additions & 3 deletions cmd/imagedeps/image-spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
minio kotsadm/minio ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-([0-9]|[1-9][0-9]*)$
rqlite kotsadm/rqlite ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-([0-9]|[1-9][0-9]*)$
dex kotsadm/dex ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-([0-9]|[1-9][0-9]*)$
minio kotsadm/minio ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-r([0-9]*)$
rqlite kotsadm/rqlite ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-r([0-9]*)$
dex kotsadm/dex ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-r([0-9]*)$
schemahero schemahero/schemahero ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$
lvp replicated/local-volume-provider ^v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$
15 changes: 0 additions & 15 deletions cmd/imagedeps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ var (
replacers = []*replacer{
getMakefileReplacer("Makefile"),
getMakefileReplacer("migrations/Makefile"),
getApkoFileReplacer("deploy/minio/apko.yaml"),
getApkoFileReplacer("deploy/rqlite/apko.yaml"),
getApkoFileReplacer("deploy/dex/apko.yaml"),
}
)

Expand Down Expand Up @@ -229,15 +226,3 @@ func getDockerfileReplacer(path string) *replacer {
},
}
}

func getApkoFileReplacer(path string) *replacer {
return &replacer{
path: path,
regexFn: func(ir *ImageRef) string {
return fmt.Sprintf(`- %s~\d+\.\d+\.\d+(?:-\d+)?`, ir.name)
},
valueFn: func(ir *ImageRef) string {
return ir.GetApkoFileLine(ir.name)
},
}
}
21 changes: 6 additions & 15 deletions cmd/imagedeps/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ import (

var (
minioTags = []string{
"0.20231101.183725-2",
"0.20231101.183725-1",
"0.20231101.183725-0",
"0.20231101.183725-r2",
"0.20231101.183725-r1",
"0.20231101.183725-r0",
"0.20231101.183725",
"0.20231100.183724",
"0.20231031.183723",
"0.20231030.183722",
}

rqliteTags = []string{
"7.21.4-1",
"7.21.4-0",
"7.21.4-r1",
"7.21.4-r0",
"7.21.4",
"7.20.3",
"7.19.2",
"6.18.1",
}

dexTags = []string{
"2.37.0-0",
"2.37.0-r0",
"2.37.0",
"2.36.0",
"2.35.0",
Expand Down Expand Up @@ -85,9 +85,6 @@ func TestFunctional(t *testing.T) {
},
),
),
replacers: []*replacer{
getApkoFileReplacer("test.apko.yaml"),
},
},
{
name: "schemahero",
Expand All @@ -112,9 +109,6 @@ func TestFunctional(t *testing.T) {
},
),
),
replacers: []*replacer{
getApkoFileReplacer("test.apko.yaml"),
},
},
{
name: "dex",
Expand All @@ -125,9 +119,6 @@ func TestFunctional(t *testing.T) {
},
),
),
replacers: []*replacer{
getApkoFileReplacer("test.apko.yaml"),
},
},
{
name: "lvp",
Expand Down
5 changes: 0 additions & 5 deletions cmd/imagedeps/tag-finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ func (ir ImageRef) GetDockerfileLine() string {
return fmt.Sprintf("ARG %s=%s", getDockerfileVarName(ir.name), ir.tag)
}

// GetApkoFileLine generates a line of text intended for use in an Apko file.
func (ir ImageRef) GetApkoFileLine(pkg string) string {
return fmt.Sprintf("- %s~%s", pkg, ir.tag)
}

type getTagsFn func(string) ([]string, error)
type getReleaseFn func(string, string) ([]*github.RepositoryRelease, error)
type tagFinderFn func(inputLine string) (*ImageRef, error)
Expand Down
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/dex/.image.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated file, do not modify. This file is generated from a text file containing a list of images. The
# most recent tag is interpolated from the source repository and used to generate a fully qualified image
# name.
DEX_TAG='2.37.0-0'
DEX_TAG='2.37.0-r0'
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/dex/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package image
// image name.

const (
Dex = "kotsadm/dex:2.37.0-0"
Dex = "kotsadm/dex:2.37.0-r0"
)
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/dex/input-spec
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dex kotsadm/dex ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-([0-9]|[1-9][0-9]*)$
dex kotsadm/dex ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-r([0-9]*)$
26 changes: 0 additions & 26 deletions cmd/imagedeps/testdata/dex/replacers/input/test.apko.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/minio/.image.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated file, do not modify. This file is generated from a text file containing a list of images. The
# most recent tag is interpolated from the source repository and used to generate a fully qualified image
# name.
MINIO_TAG='0.20231101.183725-2'
MINIO_TAG='0.20231101.183725-r2'
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/minio/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package image
// image name.

const (
Minio = "kotsadm/minio:0.20231101.183725-2"
Minio = "kotsadm/minio:0.20231101.183725-r2"
)
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/minio/input-spec
Original file line number Diff line number Diff line change
@@ -1 +1 @@
minio kotsadm/minio ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-([0-9]|[1-9][0-9]*)$
minio kotsadm/minio ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-r([0-9]*)$
24 changes: 0 additions & 24 deletions cmd/imagedeps/testdata/minio/replacers/expected/test.apko.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions cmd/imagedeps/testdata/minio/replacers/input/test.apko.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/rqlite/.image.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated file, do not modify. This file is generated from a text file containing a list of images. The
# most recent tag is interpolated from the source repository and used to generate a fully qualified image
# name.
RQLITE_TAG='7.21.4-1'
RQLITE_TAG='7.21.4-r1'
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/rqlite/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package image
// image name.

const (
Rqlite = "kotsadm/rqlite:7.21.4-1"
Rqlite = "kotsadm/rqlite:7.21.4-r1"
)
2 changes: 1 addition & 1 deletion cmd/imagedeps/testdata/rqlite/input-spec
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rqlite kotsadm/rqlite ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-([0-9]|[1-9][0-9]*)$
rqlite kotsadm/rqlite ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-r([0-9]*)$
26 changes: 0 additions & 26 deletions cmd/imagedeps/testdata/rqlite/replacers/expected/test.apko.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions cmd/imagedeps/testdata/rqlite/replacers/input/test.apko.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions deploy/dex/apko.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ contents:
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
packages:
- dex~2.37.0-0
- dex=__DEX_VERSION__
- gomplate
- bash
- busybox
Expand Down
2 changes: 1 addition & 1 deletion deploy/minio/apko.yaml → deploy/minio/apko.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ contents:
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
packages:
- minio~0.20231101.183725
- minio=__MINIO_VERSION__
- mc
- bash
- busybox
Expand Down
Loading
Loading