Skip to content

Commit

Permalink
Add ci files for playback service
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyubo committed Aug 15, 2023
1 parent 2a52b87 commit 1bc04da
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 9 deletions.
64 changes: 61 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,4 +50,62 @@ jobs:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
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 }}
10 changes: 4 additions & 6 deletions tools/PlaybackService/deployment/playbackservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Deployment
metadata:
name: playbackservice
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: playbackservice
Expand All @@ -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:
Expand Down Expand Up @@ -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: /
Expand Down

0 comments on commit 1bc04da

Please sign in to comment.