Sign inSign up

emarsys/ems-plugins-gke-service

By emarsys

•Updated about 7 years ago

Helper container to manage GKE deployments

Image
0

309

emarsys/ems-plugins-gke-service repository overview

This image helps to manage GKE deployments from CI.

For example you can deploy a new image build to staging cluster/deployment from a Jenkins CI job as follows:

  • Add your GKE service account credential file to Jenkins credentials.
  • Import the secret in your Jenkinsfile as an env variable like this: GCP_SERVICE_ACCOUNT = credentials('plugins-gcloud-ci-service-account-keyfile').
  • Use the below code in your Jenkinsfile stages:
stage('Deploy to staging') {
      steps {
        sh 'echo "$GCP_SERVICE_ACCOUNT" > ci-account.json' // create the account keyfile
        sh 'docker run --name gcloud-auth -e HTTP_PROXY="http://webproxy.emarsys.at:3128" -e HTTPS_PROXY="http://webproxy.emarsys.at:3128" -v "$(pwd)/ci-account.json:/auth/ci-account.json" emarsys/ems-plugins-gke-service /bin/bash -c "gcloud auth activate-service-account [email protected] --key-file=/auth/ci-account.json && gcloud container clusters get-credentials cluster-1 --region europe-west2 --project ems-plugins"' // authenticate and get your cluster credentials 
        sh 'docker run --rm -e HTTP_PROXY="http://webproxy.emarsys.at:3128" -e HTTPS_PROXY="http://webproxy.emarsys.at:3128" --volumes-from gcloud-auth emarsys/ems-plugins-gke-service kubectl set env deployment web-staging EXTENSION_SHA=$GIT_COMMIT' // call the actual kubectl command to deploy your new version
        sh 'docker rm gcloud-auth' //cleanup
        sh 'rm ci-account.json'
      }
    }

In this case our production container has an env variable that determines the commit hash of the extension to be installed, so we just set that env. This forces the pod to restart and install the new version. You can be creative about how you want to deploy, you can use any kubectl command.

Tag summary

Content type

Image

Digest

Size

207.7 MB

Last updated

about 7 years ago

docker pull emarsys/ems-plugins-gke-service