Skip to content

change

change #17

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
jobs:
buid:
name: GitOps Workflow
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |-
pwd
DOCKER_BUILDKIT=1 docker image build . -f app/Dockerfile --tag ${{ secrets.DH_USERNAME }}/gitops-go-app:${{ github.run_number }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ secrets.DH_USERNAME }}/gitops-go-app:${{ github.run_number }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DH_USERNAME }}
password: ${{ secrets.DH_TOKEN }}
- name: Push Image to Docker Hub
run: |-
docker image push ${{ secrets.DH_USERNAME }}/gitops-go-app:${{ github.run_number }}
- name: Checkout config repo
uses: actions/checkout@v3
with:
repository: ${{ secrets.GH_USERNAME }}/config-for-helm-sample
path: ./config-for-helm-sample
- name: Update values.yaml & Pull Request to Config Repository
run: |-
# update values.yaml in new branch
cd ./config-for-helm-sample/gitops-helm
git branch feature/${{ github.run_number }}
git checkout feature/${{ github.run_number }}
sed -i 's/tag: [0-9]*/tag: ${{ github.run_number }}/g' values.yaml
# git push
git add values.yaml
git commit -m "Update tag ${{ github.run_number }}"
# create pull request
gh pr create --title 'Update Tag ${{ github.run_number }}' --body "Please Merge!!"