Update kubernetes-cd.yml

This commit is contained in:
Cadey Ratio 2019-09-07 11:50:47 -04:00 committed by GitHub
parent 4a6a9bc9f1
commit fd852282ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 25 deletions

View File

@ -8,40 +8,53 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Build Docker Image - name: Build/Push Docker Image
run: | run: |
docker build . -t xena/christine.website:$(echo $GITHUB_SHA | head -c7) docker build . -t xena/christine.website:$(echo $GITHUB_SHA | head -c7)
- name: Setup Docker Hub
run: |
mkdir -p ~/.docker && echo $DOCKER_CONFIG > ~/.docker/config mkdir -p ~/.docker && echo $DOCKER_CONFIG > ~/.docker/config
- name: Push Docker Image
run: |
docker push xena/christine.website:$(echo $GITHUB_SHA | head -c7) docker push xena/christine.website:$(echo $GITHUB_SHA | head -c7)
- name: Setup SSH env:
run: mkdir ~/.ssh DOCKER_CONFIG: "$${ secrets.DOCKER_CONFIG }"
- name: Write SSH Key - name: Download secrets
run: echo $FILE_DATA > temp && cat temp | base64 -d > ~/.ssh/id_rsa && rm temp && md5sum ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa run: |
mkdir ~/.ssh
echo $FILE_DATA > temp
cat temp | base64 -d > ~/.ssh/id_rsa
rm temp
md5sum ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
git clone git@git.xeserv.us:xena/within-terraform-secret
env: env:
FILE_DATA: ${{ secrets.SSH_PRIVATE_KEY }} FILE_DATA: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Download secrets
run: git clone git@git.xeserv.us:xena/within-terraform-secret
env:
GIT_SSH_COMMAND: "ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" GIT_SSH_COMMAND: "ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
- name: Install Dyson - name: Install/Configure/Use Dyson
run: | run: |
curl https://xena.greedo.xeserv.us/files/dyson-linux-amd64-0.1.0.tgz | tar xz && cp ./dyson-linux-amd64-0.1.0/dyson . curl https://xena.greedo.xeserv.us/files/dyson-linux-amd64-0.1.0.tgz | tar xz
- name: Configure Dyson cp ./dyson-linux-amd64-0.1.0/dyson .
run: | rm -rf dyson-linux-amd64-0.1.0
mkdir ~/.config/dyson && echo '[DigitalOcean]\nToken = ""\n\n[Cloudflare]\nEmail = ""\nToken = ""\n\n[Secrets]\nGitCheckout = "./within-terraform-secret"' > ~/.config/dyson/dyson.ini mkdir ~/.config/dyson
- name: Generate Kubernetes manifest echo '[DigitalOcean]
run: | Token = ""
dyson manifest --name=christinewebsite --domain=christine.website --dockerImage=xena/christine.website:$(echo $GITHUB_SHA | head -c7) --containerPort=5000 --replicas=1 --useProdLE=true > deploy.yml
[Cloudflare]
Email = ""
Token = ""
[Secrets]
GitCheckout = "./within-terraform-secret"' > ~/.config/dyson/dyson.ini
dyson manifest \
--name=christinewebsite \
--domain=christine.website \
--dockerImage=xena/christine.website:$(echo $GITHUB_SHA | head -c7) \
--containerPort=5000 \
--replicas=1 \
--useProdLE=true > deploy.yml
- name: Configure Kubernetes - name: Configure Kubernetes
uses: digitalocean/action-doctl@v1.3.0 uses: digitalocean/action-doctl@v1.3.0
run: kubernetes cluster kubeconfig show kubermemes > $HOME/.kubeconfig run: |
doctl kubernetes cluster kubeconfig show kubermemes > $HOME/.kubeconfig
- name: Deploy - name: Deploy
uses: docker://lachlanevenson/k8s-kubectl uses: docker://lachlanevenson/k8s-kubectl
run: kubectl --kubeconfig=$HOME/.kubeconfig apply -f deploy.yml run: |
- name: Verify kubectl --kubeconfig=$HOME/.kubeconfig apply -f deploy.yml
uses: docker://lachlanevenson/k8s-kubectl kubectl --kubeconfig=$HOME/.kubeconfig rollout status deployment/christinewebsite
run: kubectl --kubeconfig=$HOME/.kubeconfig rollout status deployment/christinewebsite