Skip to content

cleanup unended solution task1 #473

cleanup unended solution task1

cleanup unended solution task1 #473

Workflow file for this run

name: Build Training and Publish
on:
pull_request:
paths-ignore:
- 'slides/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
-
name: Set up npm for linting
uses: actions/setup-node@v3
with:
node-version: '15.x'
-
name: Lint Markdown
run: npm ci && npm run mdlint
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Quay.io Container Registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
-
name: Build Puzzle Version
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
quay.io/puzzle/ansible-training:pr-${{ github.event.pull_request.number }}
-
name: Run vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'quay.io/puzzle/ansible-training:pr-${{ github.event.pull_request.number }}'
format: 'table'
output: 'trivy-results.txt'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os'
severity: 'CRITICAL,HIGH'
-
name: Archive vulnerability scan results
uses: actions/upload-artifact@v3
with:
name: trivy-results-build
path: trivy-results.txt
-
name: 'Install Helm'
uses: azure/setup-helm@v3
with:
version: v3.6.2
-
name: Install Kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.21.2
-
name: Deploy Helm Release
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_NAMESPACE: 'pitc-ansible-training-stg'
TRAINING_VERSION: '${{ github.sha }}'
KUBE_TOKEN: '${{ secrets.OPENSHIFT_SA_TOKEN_STG }}'
KUBE_URL: '${{ secrets.OPENSHIFT_API_URL }}'
run: |
helm upgrade $TRAINING_HELM_RELEASE acend-training-chart --install --wait --kube-apiserver=$KUBE_URL --kube-token=$KUBE_TOKEN --namespace=$TRAINING_NAMESPACE --set=app.name=$HELM_RELEASE --set=app.version=$TRAINING_VERSION --repo=https://acend.github.io/helm-charts/ --values=helm-chart/values.yaml --atomic
-
name: Redeploy Deployments
env:
TRAINING_HELM_RELEASE: 'pr-${{ github.event.pull_request.number }}'
TRAINING_NAMESPACE: 'pitc-ansible-training-stg'
KUBE_TOKEN: '${{ secrets.OPENSHIFT_SA_TOKEN_STG }}'
KUBE_URL: '${{ secrets.OPENSHIFT_API_URL }}'
run: |
kubectl rollout restart deployment/$TRAINING_HELM_RELEASE-ansible-puzzle --server=$KUBE_URL --token=$KUBE_TOKEN --namespace $TRAINING_NAMESPACE
-
name: Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
PR Environments:
* puzzle <https://ansible-pr-${{ github.event.pull_request.number }}.ocp.cloudscale.puzzle.ch>