From: Michal Privoznik <mprivozn@redhat.com>
YAML specification does not allow duplicate keys [1]:
JSON's RFC4627 requires that mappings keys merely “SHOULD” be
unique, while YAML insists they “MUST” be. Technically, YAML
therefore complies with the JSON spec, choosing to treat
duplicates as an error.
And while gitlab's documentation is a bit relaxed [2] it only
masks the problem:
When there are duplicate keys, the latest included key wins and
overrides the other keys.
Now, the 'potfile' job definition has two 'before_script' keys.
The first occurrence prints out list of installed packages, the
second exports env vars. Join them under one key.
1: https://yaml.org/spec/1.2-old/spec.html#id2759572
2: https://docs.gitlab.com/ci/yaml/yaml_optimization/#anchors
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
.gitlab-ci.yml | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e79da09443..04bfef8ed7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -127,15 +127,14 @@ potfile:
NAME: almalinux-9
before_script:
- cat /packages.txt
- needs:
- - job: x86_64-almalinux-9-container
- optional: true
- rules:
- - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- when: on_success
- - when: never
- before_script:
- *script_variables
+ needs:
+ - job: x86_64-almalinux-9-container
+ optional: true
+ rules:
+ - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+ when: on_success
+ - when: never
script:
- source ci/jobs.sh
- run_potfile
--
2.54.0
On Thu, Aug 13, 2026 at 01:51:17PM +0200, Michal Privoznik via Devel wrote: > From: Michal Privoznik <mprivozn@redhat.com> > > YAML specification does not allow duplicate keys [1]: > > JSON's RFC4627 requires that mappings keys merely “SHOULD” be > unique, while YAML insists they “MUST” be. Technically, YAML > therefore complies with the JSON spec, choosing to treat > duplicates as an error. > > And while gitlab's documentation is a bit relaxed [2] it only > masks the problem: > > When there are duplicate keys, the latest included key wins and > overrides the other keys. > > Now, the 'potfile' job definition has two 'before_script' keys. > The first occurrence prints out list of installed packages, the > second exports env vars. Join them under one key. > > 1: https://yaml.org/spec/1.2-old/spec.html#id2759572 > 2: https://docs.gitlab.com/ci/yaml/yaml_optimization/#anchors > > Signed-off-by: Michal Privoznik <mprivozn@redhat.com> > --- > .gitlab-ci.yml | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
© 2016 - 2026 Red Hat, Inc.