-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
15,696 additions
and
876 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 |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: { branches: [ "main","develop" ] } | ||
push: | ||
branches: [ "main","develop" ] | ||
tags: [ "*" ] | ||
env: | ||
KUBECONFIG: .kube/config | ||
KUBECONFIG_FILE: ${{ secrets.KUBECONFIG }} | ||
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
jobs: | ||
build: | ||
name: "Build Image" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- id: generate-image-tag | ||
name: Generate Image Tag | ||
env: | ||
ref_name: "${{ github.ref_name }}" | ||
head_ref: "${{ github.head_ref }}" | ||
run: | | ||
head_ref="${head_ref/\//-}" | ||
ref_name="${head_ref:-${ref_name/main/latest}}" | ||
echo "::set-output name=imageTag::${ref_name#v}" | ||
- name: Login to Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Push Backend | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./backend | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}/backend:${{ steps.generate-image-tag.outputs.imageTag }} | ||
ghcr.io/${{ github.repository }}/backend:${{ github.event.pull_request.head.sha || github.sha }} | ||
build-args: | | ||
COMMIT_SHA=${{ github.sha }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '17.x' | ||
registry-url: 'https://npm.pkg.github.com/' | ||
- run: npm ci --legacy-peer-deps | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
working-directory: ./frontend | ||
- run: npm run build | ||
env: | ||
CI: false | ||
working-directory: ./frontend | ||
- name: Build and Push Frontend | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./frontend | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}/frontend:${{ steps.generate-image-tag.outputs.imageTag }} | ||
ghcr.io/${{ github.repository }}/frontend:${{ github.event.pull_request.head.sha || github.sha }} | ||
deploy_development: | ||
needs: build | ||
if: github.ref == 'refs/heads/develop' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: generate-image-tag | ||
name: Generate Image Tag | ||
env: | ||
ref_name: "${{ github.ref_name }}" | ||
head_ref: "${{ github.head_ref }}" | ||
run: | | ||
head_ref="${head_ref/\//-}" | ||
ref_name="${head_ref:-${ref_name/main/latest}}" | ||
echo "::set-output name=imageTag::${ref_name#v}" | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
mkdir -p .kube | ||
echo "${{ env.KUBECONFIG_FILE }}" > $KUBECONFIG | ||
- uses: stefanprodan/kube-tools@v1 | ||
with: | ||
helmv3: 3.12.0 | ||
command: | | ||
kubectl get nodes | ||
helmv3 repo add mda-deployment https://nfdi4health.github.io/mda-deployment/ | ||
helmv3 repo update | ||
helmv3 upgrade mda-${{ steps.generate-image-tag.outputs.imageTag }} \ | ||
--install \ | ||
--set-json='images.backend="ghcr.io/${{ github.repository }}/backend:${{ github.event.pull_request.head.sha || github.sha }}"' \ | ||
--set-json='images.frontend="ghcr.io/${{ github.repository }}/frontend:${{ github.event.pull_request.head.sha || github.sha }}"' \ | ||
--set-json='images.prediction="gitlab.zbmed.de:5050/km/thesis/pierre-ba/backend:a7d3254ee488a236dade40ecedc646861aff9dbe"' \ | ||
--set-json='ingress.dns="${{ steps.generate-image-tag.outputs.imageTag }}.mda.qa.km.k8s.zbmed.de"' \ | ||
mda-deployment/metadata-annotation | ||
deploy_main: | ||
needs: build | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: generate-image-tag | ||
name: Generate Image Tag | ||
env: | ||
ref_name: "${{ github.ref_name }}" | ||
head_ref: "${{ github.head_ref }}" | ||
run: | | ||
head_ref="${head_ref/\//-}" | ||
ref_name="${head_ref:-${ref_name/main/latest}}" | ||
echo "::set-output name=imageTag::${ref_name#v}" | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
mkdir -p .kube | ||
echo "${{ env.KUBECONFIG_FILE }}" > $KUBECONFIG | ||
- uses: stefanprodan/kube-tools@v1 | ||
with: | ||
helmv3: 3.12.0 | ||
command: | | ||
kubectl get nodes | ||
helmv3 repo add mda-deployment https://nfdi4health.github.io/mda-deployment/ | ||
helmv3 repo update | ||
helmv3 upgrade mda-${{ steps.generate-image-tag.outputs.imageTag }} \ | ||
--install \ | ||
--set-json='images.backend="ghcr.io/${{ github.repository }}/backend:${{ github.event.pull_request.head.sha || github.sha }}"' \ | ||
--set-json='images.frontend="ghcr.io/${{ github.repository }}/frontend:${{ github.event.pull_request.head.sha || github.sha }}"' \ | ||
--set-json='images.prediction="gitlab.zbmed.de:5050/km/thesis/pierre-ba/backend:a7d3254ee488a236dade40ecedc646861aff9dbe"' \ | ||
--set-json='ingress.dns="${{ steps.generate-image-tag.outputs.imageTag }}.mda.qa.km.k8s.zbmed.de"' \ | ||
mda-deployment/metadata-annotation |
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,37 @@ | ||
name: Deployment to production | ||
concurrency: production | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tags: | ||
description: 'Do you really want to update the production instance' | ||
required: false | ||
type: boolean | ||
image_sha: | ||
description: 'Image SHA ID, Optional ' | ||
type: string | ||
required: false | ||
env: | ||
KUBECONFIG: .kube/config | ||
KUBECONFIG_FILE: ${{ secrets.KUBECONFIG_PROD }} | ||
jobs: | ||
deployment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
mkdir -p .kube | ||
echo "${{ env.KUBECONFIG_FILE }}" > $KUBECONFIG | ||
- uses: stefanprodan/kube-tools@v1 | ||
with: | ||
helmv3: 3.12.0 | ||
command: | | ||
helmv3 repo add mda-deployment https://nfdi4health.github.io/mda-deployment/ | ||
helmv3 repo update | ||
helmv3 upgrade mda-main \ | ||
--install \ | ||
--set-json='images.backend="ghcr.io/${{ github.repository }}/backend:${{ github.event.pull_request.head.sha || github.sha }}"' \ | ||
--set-json='images.frontend="ghcr.io/${{ github.repository }}/frontend:${{ github.event.pull_request.head.sha || github.sha }}"' \ | ||
--set-json='images.prediction="gitlab.zbmed.de:5050/km/thesis/pierre-ba/backend:a7d3254ee488a236dade40ecedc646861aff9dbe"' \ | ||
--set-json='ingress.dns="mda.main.prod.km.k8s.zbmed.de"' \ | ||
mda-deployment/metadata-annotation |
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
Oops, something went wrong.