-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from gulfofmaine/change/argo-cd
Clean up to make compatible with Argo CD
- Loading branch information
Showing
9 changed files
with
117 additions
and
62 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,20 +3,15 @@ name: CI | |
on: [push] | ||
|
||
jobs: | ||
test: | ||
name: Build and test | ||
build: | ||
name: Build | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Docker Data | ||
run: | | ||
mkdir docker-data | ||
cat <<< "${{ secrets.DOCKER_DATA_SECRET }}" > docker-data/secret.env | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
|
@@ -27,6 +22,14 @@ jobs: | |
key: buoy-barn-buildx-${{ github.sha }} | ||
restore-keys: | | ||
buoy-barn-buildx- | ||
- name: Cache Docker image | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/myimage.tar | ||
key: mariners-dashboard-image-${{ github.sha }} | ||
restore-keys: | | ||
mariners-dashboard-image- | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
|
@@ -43,7 +46,40 @@ jobs: | |
tags: gmri/neracoos-buoy-barn:latest | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
outputs: type=docker | ||
outputs: type=docker,dest=/tmp/myimage.tar | ||
|
||
- name: Move Docker Cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
test: | ||
name: Unit Tests | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 15 | ||
needs: build | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/[email protected] | ||
|
||
- name: Cache Docker image | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/myimage.tar | ||
key: mariners-dashboard-image-${{ github.sha }} | ||
restore-keys: | | ||
mariners-dashboard-image- | ||
- name: Load Docker image | ||
run: | | ||
docker load --input /tmp/myimage.tar | ||
docker image ls -a | ||
- name: Setup Docker Data | ||
run: | | ||
mkdir docker-data | ||
cat <<< "${{ secrets.DOCKER_DATA_SECRET }}" > docker-data/secret.env | ||
- name: Bring up server | ||
run: docker-compose up -d | ||
|
@@ -62,7 +98,64 @@ jobs: | |
env: | ||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
|
||
- name: Move Docker Cache | ||
deploy: | ||
name: Build and Push tagged image to Docker Hub, and update Argo config | ||
runs-on: ubuntu-20.04 | ||
needs: test | ||
environment: | ||
name: Buoy Barn via Argo CD | ||
url: https://buoy-barn.neracoos.org/admin/ | ||
if: | | ||
github.repository == 'gulfofmaine/buoy-barn' | ||
&& contains(github.ref, 'refs/tags/v') | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/[email protected] | ||
|
||
- name: Cache Docker image | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/myimage.tar | ||
key: mariners-dashboard-image-${{ github.sha }} | ||
restore-keys: | | ||
mariners-dashboard-image- | ||
- name: Load Docker image | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
docker load --input /tmp/myimage.tar | ||
docker image ls -a | ||
- name: "Login to Docker Hub" | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Get tag name | ||
uses: olegtarasov/[email protected] | ||
id: tagName | ||
|
||
- name: Tag Docker image | ||
run: docker tag gmri/neracoos-buoy-barn gmri/neracoos-buoy-barn:${{ steps.tagName.outputs.tag }} | ||
|
||
- name: Push Docker image | ||
run: docker push gmri/neracoos-buoy-barn:${{ steps.tagName.outputs.tag }} | ||
|
||
- name: Make GitOps directory | ||
run: mkdir gitops | ||
|
||
- name: Clone GitOps config repo | ||
run: git clone "https://[email protected]/gulfofmaine/neracoos-do-cd.git" | ||
working-directory: ./gitops | ||
env: | ||
GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }} | ||
|
||
- name: Update GitOps config repo | ||
working-directory: ./gitops/neracoos-do-cd | ||
run: | | ||
sed -i 's/?ref=.\+/?ref=${{ steps.tagName.outputs.tag }}/' apps/buoy-barn/kustomization.yaml | ||
sed -i 's/newTag: .\+/newTag: ${{ steps.tagName.outputs.tag }}/' apps/buoy-barn/kustomization.yaml | ||
git config --global user.email '[email protected]' | ||
git config --global user.name 'NERACOOS Buoy Barn CI' | ||
git diff --exit-code && echo 'Already Deployed' || (git commit -am 'Upgrade Buoy Barn to ${{ steps.tagName.outputs.tag }}' && git push) |
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
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