From 08a26cef2490db0a531c45a4458ce7f33b5e474b Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 26 Oct 2018 15:30:36 +0300 Subject: [PATCH] Add GitHub Actions docs --- README.md | 1 + docs/8-gh-actions.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 docs/8-gh-actions.md diff --git a/README.md b/README.md index 566be0c..5b43b4b 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,4 @@ Web API: * [Expose Kubernetes services over HTTPS with Ngrok](docs/6-ngrok.md) * [A/B Testing with Ambassador API Gateway](docs/5-canary.md) * [Canary Deployments with Istio](docs/7-istio.md) +* [GitHub Actions CI demo](docs/8-gh-actions.md) diff --git a/docs/8-gh-actions.md b/docs/8-gh-actions.md new file mode 100644 index 0000000..defe645 --- /dev/null +++ b/docs/8-gh-actions.md @@ -0,0 +1,36 @@ +# GitHub Actions + +Create a private repository named `demo-app` on GitHub and navigate to Settings/Secrets and add the following secrets: + +* `DOCKER_IMAGE` eg stefanprodan/demo-app +* `DOCKER_USERNAME` eg stefanprodan +* `DOCKER_PASSWORD` eg my-docker-hub-pass + +Install podinfo CLI: + +```bash +go get -u github.com/stefanprodan/k8s-podinfo/cmd/podcli +``` + +If you don't have golang installed go to the +[release page](https://github.com/stefanprodan/k8s-podinfo/releases), download the latest podcli release and add it to your path. + +Clone your private repository (preferable in your `$GOPATH`) and initialize podinfo. + +```bash +git clone https://github.com/stefanprodan/demo-app +cd demo-app + +podcli code init demo-app --git-user=stefanprodan --version=v1.3.0 +``` + +The above command does the following: +* downloads podinfo source code v1.3.0 from GitHub +* replaces golang import with your git username and project name +* commits and pushes the code to GitHub + +When the code init command finishes, GitHub will test, build and push a Docker image +`${DOCKER_IMAGE}:${GIT-BRANCH}-${GIT-SHORT-SHA}` to your Docker Hub account. + +If you create a GitHub release a Docker image with the format `${DOCKER_IMAGE}:${GIT-TAG}` will be published to Docker Hub. +