Commit f5579abc authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Lin Jen-Shin

Make it possible to easily deploy serverless functions

This commits add a job that is going to be triggered whenever someone
adds `[serverless deploy-functions]` text into their commit message.

This make it really simple to deploy functions in FaaS-only project.
parent 27417ccf
...@@ -6,7 +6,7 @@ stages: ...@@ -6,7 +6,7 @@ stages:
- build - build
- deploy - deploy
.serverless:build:dockerfile: .serverless:build:image:
variables: variables:
DOCKERFILE: "Dockerfile" DOCKERFILE: "Dockerfile"
stage: build stage: build
...@@ -14,7 +14,8 @@ stages: ...@@ -14,7 +14,8 @@ stages:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
entrypoint: [""] entrypoint: [""]
only: only:
- master refs:
- master
script: script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - 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 - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/$DOCKERFILE --destination $CI_REGISTRY_IMAGE
...@@ -23,7 +24,8 @@ stages: ...@@ -23,7 +24,8 @@ stages:
stage: deploy stage: deploy
image: gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 image: gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5
only: only:
- master refs:
- master
environment: development environment: development
script: script:
- echo "$CI_REGISTRY_IMAGE" - echo "$CI_REGISTRY_IMAGE"
...@@ -37,3 +39,10 @@ stages: ...@@ -37,3 +39,10 @@ stages:
- 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_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" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_DEPLOY_USER" --password "$CI_DEPLOY_PASSWORD" --pull
- tm -n "$KUBE_NAMESPACE" deploy --wait - tm -n "$KUBE_NAMESPACE" deploy --wait
deploy-functions:
extends: .serverless:deploy:functions
environment: production
only:
variables:
- $CI_COMMIT_MESSAGE =~ /\[serverless deploy-functions\]/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment