-
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 #34 from acend/build-tag-version
Create Image Version Tag on release
- Loading branch information
Showing
5 changed files
with
109 additions
and
67 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: Build & deploy Release Version | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'webshell-*' # This is created when push on main when Helm Chart version was changed | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to Quay.io Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAYIO_USERNAME }} | ||
password: ${{ secrets.QUAYIO_TOKEN }} | ||
|
||
- | ||
name: Get the version # strip away "ref/tags/webshell-" | ||
id: get_version | ||
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | sed 's/webshell-//g') | ||
|
||
- | ||
name: Build Release Version | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
quay.io/acend/theia:${{ steps.get_version.outputs.VERSION }} | ||
- | ||
name: Run vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: 'quay.io/acend/theia:${{ steps.get_version.outputs.VERSION }}' | ||
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@v2 | ||
with: | ||
name: trivy-results-main | ||
path: trivy-results.txt | ||
deploy: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- | ||
name: 'Install Helm' | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.6.2 | ||
- | ||
name: Install Kubectl | ||
uses: azure/setup-kubectl@v1 | ||
with: | ||
version: v1.21.2 | ||
- | ||
name: Create KUBECONFIG | ||
env: | ||
KUBE_CONFIG: '${{ secrets.KUBECONFIG }}' | ||
run: | | ||
mkdir -p $HOME/.kube | ||
echo "$KUBE_CONFIG" > $HOME/.kube/config | ||
- | ||
name: Deploy Helm Release | ||
env: | ||
HELM_RELEASE: 'demo-webshell' | ||
NAMESPACE: 'acend-webshell' | ||
PASSWORD: '${{ secrets.WEBSHELL_TEST_PASSWORD }}' | ||
run: | | ||
helm upgrade $HELM_RELEASE webshell --install --wait --kubeconfig $HOME/.kube/config --namespace=$NAMESPACE --repo=https://acend.github.io/webshell-env/ --set password=$PASSWORD --values=helm-chart/values.yaml --atomic | ||
- | ||
name: Redeploy Webshell | ||
env: | ||
NAMESPACE: 'acend-webshell' | ||
HELM_RELEASE: 'demo-webshell' | ||
run: | | ||
kubectl rollout restart deployment/$HELM_RELEASE --kubeconfig $HOME/.kube/config --namespace $NAMESPACE |
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