Skip to content

Commit

Permalink
remove harness k8s pod update (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
DioniPinho committed Oct 5, 2020
1 parent 42d660c commit d946ced
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
14 changes: 1 addition & 13 deletions .circleci/ci-cd-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## Requirements
- Repository Account like Github, Bitbucket or others.
- kubernetes cluster.
- CircleCi Account.

To learn how to set up a cluster, see:
Expand Down Expand Up @@ -46,19 +45,8 @@ User to login to Docker Hub.
* **DOCKER_REPOSITORY**
Image Repository on Docker Hub eg.: `actionml/harness`

* **K8S_ADMIN_PASS**
K8s cluster administrator user.

* **K8S_ADMIN_USER**
K8s cluster administrator password.

* **K8S_SERVER**
Kubernetes cluster api endpoint.

![5](https://user-images.githubusercontent.com/17029741/68024690-95798900-fc89-11e9-92ef-e187201409bf.png)

Change your previous config.yml file with this [config.yml](https://github.com/actionml/harness/blob/develop/.circleci/config.yml) file.

Commit and push again.

Now your circleci is ready to watch changes in your repository, build, push new image version and update kubernetes.
Now your circleci is ready to watch changes in your repository, build and push new image version.
24 changes: 2 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- attach_workspace:
at: /root/project/dist
- run:
name: Install Docker Compose and Kubectl
name: Install Docker Compose
command: |
set -x
chmod +x docker/config-dependencies.sh
Expand Down Expand Up @@ -103,9 +103,7 @@ jobs:
- run:
name: Publish docker image
command: |
# TODO: Enable integration test after test fixed
echo "export RESULT=0" >> $SHELL_ENV
source $SHELL_ENV
echo "Result is ${RESULT}"
Expand All @@ -130,24 +128,6 @@ jobs:
;;
esac
fi
- run:
name: Update kubernetes Deployment
command: |
source $SHELL_ENV
if [ $RESULT -eq 0 ]
then
case "${CIRCLE_BRANCH}" in
"develop")
BRANCH=`echo "${CIRCLE_BRANCH}" | sed s/'\/'/-/g`
kubectl patch statefulset harness --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"actionml/harness:'$BRANCH'"}]'
kubectl delete pod harness-0
;;
*)
;;
esac
fi
workflows:
version: 2
default:
Expand Down
10 changes: 0 additions & 10 deletions docker/config-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,3 @@ apk add --no-cache --update py-pip python3-dev libffi-dev openssl-dev gcc libc-d
pip install docker-compose==1.12.0
docker-compose version

# == Install Kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl

# == Configure K8s Cluster
kubectl config set-credentials admin --username=${K8S_ADMIN_USER} --password=${K8S_ADMIN_PASS}
kubectl config set-cluster k8s.cluster --insecure-skip-tls-verify=true --server=${K8S_SERVER}
kubectl config set-context k8s.cluster --user=admin --namespace=default --cluster=k8s.cluster
kubectl config use-context k8s.cluster

0 comments on commit d946ced

Please sign in to comment.