Add Gitlab Templates for Docker, RTD, and GS
[releng.git] / gitlab-templates / GoogleStorage.gitlab-ci.yml
diff --git a/gitlab-templates/GoogleStorage.gitlab-ci.yml b/gitlab-templates/GoogleStorage.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..be941a8
--- /dev/null
@@ -0,0 +1,30 @@
+# Template for uploading artifacts to Google Storage
+#
+# To upload artifacts to Google Storage, include this file in your
+# .gitlab-ci.yml file with the following stanza:
+#
+#   include:
+#     - project: anuket/releng
+#       file: '/gitlab-templates/GoogleStorage.gitlab-ci.yml'
+#
+# And append the following "- !reference.." line to the script portion
+# of a job where artifacts should be uploaded:
+#
+#   script:
+#      ...
+#      - !reference [.gsutil-install, script]
+#      ...
+#
+# After the script has been included `gsutil` will have access to the
+# necessary Google Storage bucket.
+---
+variables:
+  GS_URL: "artifacts.opnfv.org/$CI_PROJECT_NAME"
+  WORKSPACE: $CI_PROJECT_DIR
+
+.gsutil-install: &gsutil-install
+  script:
+    - dnf -y install python3-pip
+    - python3 -m pip install -U pip
+    - python3 -m pip install gsutil
+    - echo "$GSUTIL_CONFIG" > ~/.boto