Skip to content

Instantly share code, notes, and snippets.

@hatembentayeb
Forked from tvvignesh/.gitlab-ci.yml
Created June 1, 2020 23:17
Show Gist options
  • Save hatembentayeb/e294dee618b81ea3d78a21451c4040f5 to your computer and use it in GitHub Desktop.
Save hatembentayeb/e294dee618b81ea3d78a21451c4040f5 to your computer and use it in GitHub Desktop.
Example on running Skaffold with GITLAB CI for Kubernetes in GKE (Make sure you modify it appropriately and set GCP_SERVICE_KEY and GCP_PROD_SERVICE_KEY variable in Gitlab with the service account json value)
services:
- docker:dind
stages:
- development
- production
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ''
DOCKER_HOST: tcp://docker:2375
development:
image:
name: gcr.io/k8s-skaffold/skaffold:latest
stage: development
script:
- echo "$GCP_SERVICE_KEY" > gcloud-service-key.json
- gcloud auth activate-service-account --key-file gcloud-service-key.json
- gcloud config set project project-dev
- gcloud config set compute/zone asia-south1-a
- gcloud container clusters get-credentials cluster-dev
- kubectl config get-contexts
- skaffold run
only:
- master
production:
image:
name: gcr.io/k8s-skaffold/skaffold:latest
stage: production
script:
- echo "$GCP_PROD_SERVICE_KEY" > gcloud-service-key.json
- gcloud auth activate-service-account --key-file gcloud-service-key.json
- gcloud config set project project-prod
- gcloud config set compute/zone asia-south1-a
- gcloud container clusters get-credentials cluster-prod
- kubectl config get-contexts
- skaffold run -p production
only:
- production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment