Skip to content

Commit

Permalink
MariaDB operator - add trigger
Browse files Browse the repository at this point in the history
Take the sha from the pushed manifest as the arg to
pass to the github mariadb operator.
  • Loading branch information
grooverdan authored and RazvanLiviuVarzaru committed Aug 19, 2024
1 parent 23df9cf commit 3d51150
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
49 changes: 49 additions & 0 deletions master-nonlatent/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,55 @@ f_dockerlibrary.addStep(
],
)
)
f_dockerlibrary.addStep(
steps.SetPropertyFromCommand(
name="Extract the last tag created",
command=["cat", "last_tag"],
property="lasttag",
)
)
f_dockerlibrary.addStep(
steps.SetPropertyFromCommand(
name="Determine sha for the last tag",
command=[
"bash",
"-xc",
util.Interpolate(
"curl -s https://quay.io/api/v1/repository/mariadb-foundation/mariadb-devel/tag/?filter_tag_name=eq:%(prop:lasttag)s&onlyActiveTags=true | jq -r .tags[0].manifest_digest"
),
],
property="lastsha",
)
)
f_dockerlibrary.addStep(
steps.ShellCommand(
name="gh credentials",
command=[
"bash",
"-xc",
"gh auth login --with-token < ~/gh_auth",
],
doStepIf=lambda step: (str(step.getProperty("lastsha")) != ""),
)
)
f_dockerlibrary.addStep(
steps.ShellCommand(
name="test operator with image",
command=[
"bash",
"-xc",
util.Interpolate(
"gh workflow run %(kw:testname)s --repo mariadb-operator/mariadb-operator -f mariadb_image=quay.io/mariadb-foundation/mariadb-devel@%(prop:lastsha)s",
testname=lambda step: (
"test-image-ent.yml"
if "rhel" in str(step.getProperty("parentbuildername"))
else "test-image.yml"
),
),
],
doStepIf=lambda step: (str(step.getProperty("lastsha")) != ""),
)
)

## f_aix
f_aix = util.BuildFactory()
Expand Down
3 changes: 3 additions & 0 deletions scripts/docker-library-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ commit=${4:-0}
branch=${5:-${master_branch}}
prod_environment=${6:-True}

rm -f last_tag
# keep in sync with docker-cleanup script
if [[ $branch = *pkgtest* ]]; then
container_tag=${branch#bb-}
Expand Down Expand Up @@ -181,8 +182,10 @@ if (($(buildah manifest inspect "$devmanifest" | jq '.manifests | length') >= ex
trap 'manifest_image_cleanup "$t"' EXIT
if [ "$prod_environment" = "True" ]; then
buildah manifest push --all --rm "$devmanifest" "docker://quay.io/mariadb-foundation/mariadb-devel:${container_tag}"
echo "${container_tag}" > last_tag
else
buildah manifest rm "$devmanifest"
rm -f last_tag
fi
manifest_image_cleanup "$t"

Expand Down

0 comments on commit 3d51150

Please sign in to comment.