From 3a7b9dde359d51c9f4bc60578b1cbc89c6ebe91e Mon Sep 17 00:00:00 2001 From: xyb Date: Tue, 15 Aug 2023 11:31:26 -0700 Subject: [PATCH] Add ci files for playback service --- .github/workflows/ci-build.yml | 64 ++++++++++++++++++- .../deployment/playbackservice.yaml | 10 ++- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 59d5790..6e6bf40 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -2,9 +2,9 @@ name: Docker Image CI on: push: - branches: [ "main" ] + branches: [ "main", "deploy-test" ] pull_request: - branches: [ "main" ] + branches: [ "main", "deploy-test" ] env: REGISTRY: ghcr.io @@ -50,4 +50,62 @@ jobs: context: . push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + + build-playbackservice: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup DotNet Environment + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + + - name: Build and publish + run: | + dotnet publish -c Release tools/PlaybackService + + - name: Test + run: | + dotnet test -c Release --no-build tools/PlaybackService + + - name: Build Container Image + uses: docker/build-push-action@v4 + with: + context: tools/PlaybackService/src/ + tags: ghcr.io/azure/azure-media-migration-playback-service:${{ github.sha }}, ghcr.io/azure/azure-media-migration-playback-service:latest + + - name: Log in to the Container registry + uses: docker/login-action@v2 + if: ${{ github.event_name == 'push' }} + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push Container Image + if: ${{ github.event_name == 'push' }} + run: | + docker push ghcr.io/azure/azure-media-migration-playback-service:${{ github.sha }} + docker push ghcr.io/azure/azure-media-migration-playback-service:latest + + - name: Login Kubernets + uses: azure/k8s-set-context@v1 + if: ${{ github.event_name == 'push' }} + with: + kubeconfig: '${{ secrets.AMSTEST_EASTUS_KUBECONFIG }}' + + - name: Deploy + uses: Azure/k8s-deploy@v4 + if: ${{ github.event_name == 'push' }} + with: + namespace: amstest + manifests: | + tools/PlaybackService/deployment/playbackservice.yaml + images: | + ghcr.io/azure/azure-media-migration-playback-service:${{ github.sha }} \ No newline at end of file diff --git a/tools/PlaybackService/deployment/playbackservice.yaml b/tools/PlaybackService/deployment/playbackservice.yaml index c4b4e07..ce146df 100644 --- a/tools/PlaybackService/deployment/playbackservice.yaml +++ b/tools/PlaybackService/deployment/playbackservice.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: playbackservice spec: - replicas: 2 + replicas: 1 selector: matchLabels: app: playbackservice @@ -12,11 +12,9 @@ spec: labels: app: playbackservice spec: - imagePullSecrets: - - name: amtestcr-secret containers: - name: playbackservice - image: amstest.azurecr.io/ams-ok/playbackservice:latest + image: ghcr.io/azure/azure-media-migration-playback-service:latest ports: - containerPort: 80 env: @@ -62,10 +60,10 @@ metadata: spec: tls: - hosts: - - playback.ams-ok.net + - playback.amstest.org secretName: playbackservice-https-cert rules: - - host: playback.ams-ok.net + - host: playback.amstest.org http: paths: - path: /