Skip to content

Commit 3d51150

Browse files
grooverdanRazvanLiviuVarzaru
authored andcommitted
MariaDB operator - add trigger
Take the sha from the pushed manifest as the arg to pass to the github mariadb operator.
1 parent 23df9cf commit 3d51150

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

master-nonlatent/master.cfg

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,55 @@ f_dockerlibrary.addStep(
738738
],
739739
)
740740
)
741+
f_dockerlibrary.addStep(
742+
steps.SetPropertyFromCommand(
743+
name="Extract the last tag created",
744+
command=["cat", "last_tag"],
745+
property="lasttag",
746+
)
747+
)
748+
f_dockerlibrary.addStep(
749+
steps.SetPropertyFromCommand(
750+
name="Determine sha for the last tag",
751+
command=[
752+
"bash",
753+
"-xc",
754+
util.Interpolate(
755+
"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"
756+
),
757+
],
758+
property="lastsha",
759+
)
760+
)
761+
f_dockerlibrary.addStep(
762+
steps.ShellCommand(
763+
name="gh credentials",
764+
command=[
765+
"bash",
766+
"-xc",
767+
"gh auth login --with-token < ~/gh_auth",
768+
],
769+
doStepIf=lambda step: (str(step.getProperty("lastsha")) != ""),
770+
)
771+
)
772+
f_dockerlibrary.addStep(
773+
steps.ShellCommand(
774+
name="test operator with image",
775+
command=[
776+
"bash",
777+
"-xc",
778+
util.Interpolate(
779+
"gh workflow run %(kw:testname)s --repo mariadb-operator/mariadb-operator -f mariadb_image=quay.io/mariadb-foundation/mariadb-devel@%(prop:lastsha)s",
780+
testname=lambda step: (
781+
"test-image-ent.yml"
782+
if "rhel" in str(step.getProperty("parentbuildername"))
783+
else "test-image.yml"
784+
),
785+
),
786+
],
787+
doStepIf=lambda step: (str(step.getProperty("lastsha")) != ""),
788+
)
789+
)
741790

742791
## f_aix
743792
f_aix = util.BuildFactory()

scripts/docker-library-manifest.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ commit=${4:-0}
1111
branch=${5:-${master_branch}}
1212
prod_environment=${6:-True}
1313

14+
rm -f last_tag
1415
# keep in sync with docker-cleanup script
1516
if [[ $branch = *pkgtest* ]]; then
1617
container_tag=${branch#bb-}
@@ -181,8 +182,10 @@ if (($(buildah manifest inspect "$devmanifest" | jq '.manifests | length') >= ex
181182
trap 'manifest_image_cleanup "$t"' EXIT
182183
if [ "$prod_environment" = "True" ]; then
183184
buildah manifest push --all --rm "$devmanifest" "docker://quay.io/mariadb-foundation/mariadb-devel:${container_tag}"
185+
echo "${container_tag}" > last_tag
184186
else
185187
buildah manifest rm "$devmanifest"
188+
rm -f last_tag
186189
fi
187190
manifest_image_cleanup "$t"
188191

0 commit comments

Comments
 (0)