Support CentOS 7 in GoogleStorage Gitlab template
[releng.git] / gitlab-templates / GoogleStorage.gitlab-ci.yml
1 # Template for uploading artifacts to Google Storage
2 #
3 # To upload artifacts to Google Storage, include this file in your
4 # .gitlab-ci.yml file with the following stanza:
5 #
6 #   include:
7 #     - project: anuket/releng
8 #       file: '/gitlab-templates/GoogleStorage.gitlab-ci.yml'
9 #
10 # And append the following "- !reference.." line to the script portion
11 # of a job where artifacts should be uploaded:
12 #
13 #   script:
14 #      ...
15 #      - !reference [.gsutil-install, script]
16 #      ...
17 #
18 # After the script has been included `gsutil` will have access to the
19 # necessary Google Storage bucket.
20 ---
21 variables:
22   GS_URL: "artifacts.opnfv.org/$CI_PROJECT_NAME"
23   WORKSPACE: $CI_PROJECT_DIR
24
25 .gsutil-install: &gsutil-install
26   script:
27     - |
28         if command -v dnf &> /dev/null; then
29           dnf -y install python3-pip
30         else
31           yum -y install python3-pip
32         fi
33     - python3 -m pip install -U pip
34     - python3 -m pip install gsutil
35     - echo "$GSUTIL_CONFIG" > ~/.boto