gitlab: Fix printing of installed packages for 'potfile' job

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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik committed 2026-08-13 14:11:37 +02:00
1 parent 43d478ac1e
commit 8bd67c053b
1 file changed
+1 -2
+1 -2
View File
@@ -127,6 +127,7 @@ potfile:
NAME: almalinux-9
before_script:
- cat /packages.txt
- *script_variables
needs:
- job: x86_64-almalinux-9-container
optional: true
@@ -134,8 +135,6 @@ potfile:
- 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
script:
- source ci/jobs.sh
- run_potfile