Created
June 17, 2020 07:00
-
-
Save velotiotech/865e91f9f8a9094d171e15cd4f0175a2 to your computer and use it in GitHub Desktop.
deploy job for the blog ci/cd pipeline for k8s using circleci & helm task.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deploy: | |
docker: (1) | |
- image: circleci/golang:1.10 | |
steps: (2) | |
- checkout | |
- run: (3) | |
name: Install AWS cli | |
command: export TZ=Europe/Minsk && sudo ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > sudo /etc/timezone && sudo apt-get update && sudo apt-get install -y awscli | |
- run: (4) | |
name: Set the tag for the image, we will concatenate the app verson and circle build number with a `-` char in between | |
command: echo 'export TAG=$(cat VERSION)-$CIRCLE_PREVIOUS_BUILD_NUM' >> $BASH_ENV | |
- run: (5) | |
name: Install and confgure kubectl | |
command: sudo curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && sudo chmod +x /usr/local/bin/kubectl | |
- run: (6) | |
name: Install and confgure kubectl aws-iam-authenticator | |
command: curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator && sudo chmod +x ./aws-iam-authenticator && sudo cp ./aws-iam-authenticator /bin/aws-iam-authenticator | |
- run: (7) | |
name: Install latest awscli version | |
command: sudo apt install unzip && curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && unzip awscli-bundle.zip &&./awscli-bundle/install -b ~/bin/aws | |
- run: (8) | |
name: Get the kubeconfig file | |
command: export KUBECONFIG=$HOME/.kube/kubeconfig && /home/circleci/bin/aws eks --region $AWS_REGION update-kubeconfig --name $EKS_CLUSTER_NAME | |
- run: (9) | |
name: Install and configuire helm | |
command: sudo curl -L https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz | tar xz && sudo mv linux-amd64/helm /bin/helm && sudo rm -rf linux-amd64 | |
- run: (10) | |
name: Initialize helm | |
command: helm init --client-only --kubeconfig=$HOME/.kube/kubeconfig | |
- run: (11) | |
name: Install tiller plugin | |
command: helm plugin install https://github.com/rimusz/helm-tiller --kubeconfig=$HOME/.kube/kubeconfig | |
- run: (12) | |
name: Release helloapp using helm chart | |
command: bash scripts/release-helloapp.sh $TAG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment