summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/templates/Serverless.gitlab-ci.yml
blob: b4b4cc1f01a68eef7c017da09972ac986b968dbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# GitLab Serverless template

image: alpine:latest

stages:
  - build
  - test
  - deploy

.serverless:build:image:
  variables:
    DOCKERFILE: "Dockerfile"
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  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:3cfdd470a66b741004fb02354319d79f1598c70117ce79978d2e07e192bfb336 # v0.0.11
  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:build:functions:
  stage: build
  environment: development
  image: registry.gitlab.com/gitlab-org/gitlabktl:latest
  script: /usr/bin/gitlabktl serverless build

.serverless:deploy:functions:
  stage: deploy
  environment: development
  image: registry.gitlab.com/gitlab-org/gitlabktl:latest
  script: /usr/bin/gitlabktl serverless deploy