On Fri, Mar 27, 2020 at 06:15:58PM +0100, Andrea Bolognani wrote:
This template provides a standardized place where environment
variables, which might not be static but depend on the output of
some shell command, can be defined for later use. It's not very
interesting right now, but we'll put it to good use in a second.
This pattern is already used in libosinfo's GitLab CI integration.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
.gitlab-ci.yml | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1e3675ace0..eeeff7ed48 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,4 @@
variables:
- MAKE: make
GIT_DEPTH: 100
stages:
@@ -7,6 +6,8 @@ stages:
- native_build
- cross_build
+.environment: &environment |
Use of the name ".environment" is undesirable as there's a standard
key called "environment" already that has completely different
semantics. ".script_variables" is a better choice to align with
the normal naming.
That said, I don't think we should be moving the MAKE variable
definition. IMHO we should stick with the standard "variables"
block, except in case where we need to dynamically set a value
based on some live shell expansion, as is done in the variables
in the before_script
+ export MAKE="make"
# Common templates
@@ -18,6 +19,7 @@ stages:
- ccache/
key: "$CI_JOB_NAME"
before_script:
+ - *environment
- mkdir -p ccache
- export CC="ccache gcc"
- export CCACHE_BASEDIR=${PWD}
@@ -45,6 +47,7 @@ stages:
- ccache/
key: "$CI_JOB_NAME"
before_script:
+ - *environment
- mkdir -p ccache
- export CC="ccache ${ABI}-gcc"
- export CCACHE_BASEDIR=${PWD}
@@ -163,6 +166,8 @@ mingw64-fedora-30:
#
https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=w...
website:
stage: prebuild
+ before_script:
+ - *environment
script:
- mkdir build
- cd build
@@ -183,6 +188,8 @@ website:
codestyle:
stage: prebuild
+ before_script:
+ - *environment
script:
- mkdir build
- cd build
@@ -198,6 +205,8 @@ potfile:
stage: prebuild
only:
- master
+ before_script:
+ - *environment
script:
- mkdir build
- cd build
@@ -222,6 +231,8 @@ potfile:
dco:
stage: prebuild
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+ before_script:
+ - *environment
script:
- ./scripts/require-dco.py
only:
--
2.25.1
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|