summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-02-25 14:06:52 +0100
committerLin Jen-Shin <godfat@godfat.org>2019-03-04 21:09:38 +0800
commit27417ccf3cd4c6e9318f8671c02400352dbdaa9f (patch)
tree728178983cc5c9798d1a92c13658ae7b0bc7be83 /lib
parentf8b1ef924e3b405cd72468fce236eb456a9a501d (diff)
downloadgitlab-ce-27417ccf3cd4c6e9318f8671c02400352dbdaa9f.tar.gz
Add Serverless CI/CD template
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/templates/Serverless.gitlab-ci.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/gitlab/ci/templates/Serverless.gitlab-ci.yml b/lib/gitlab/ci/templates/Serverless.gitlab-ci.yml
new file mode 100644
index 00000000000..3f7a8190e99
--- /dev/null
+++ b/lib/gitlab/ci/templates/Serverless.gitlab-ci.yml
@@ -0,0 +1,39 @@
+# GitLab Serverless template
+
+image: alpine:latest
+
+stages:
+ - build
+ - deploy
+
+.serverless:build:dockerfile:
+ variables:
+ DOCKERFILE: "Dockerfile"
+ stage: build
+ image:
+ name: gcr.io/kaniko-project/executor:debug
+ entrypoint: [""]
+ only:
+ - master
+ script:
+ - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
+ - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/$DOCKERFILE --destination $CI_REGISTRY_IMAGE
+
+.serverless:deploy:image:
+ stage: deploy
+ image: gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5
+ only:
+ - master
+ environment: development
+ script:
+ - echo "$CI_REGISTRY_IMAGE"
+ - tm -n "$KUBE_NAMESPACE" --config "$KUBECONFIG" deploy service "$CI_PROJECT_NAME" --from-image "$CI_REGISTRY_IMAGE" --wait
+
+.serverless:deploy:functions:
+ stage: deploy
+ environment: development
+ image: gcr.io/triggermesh/tm:v0.0.9
+ script:
+ - tm -n "$KUBE_NAMESPACE" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_REGISTRY_USER" --password "$CI_JOB_TOKEN" --push
+ - tm -n "$KUBE_NAMESPACE" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_DEPLOY_USER" --password "$CI_DEPLOY_PASSWORD" --pull
+ - tm -n "$KUBE_NAMESPACE" deploy --wait