This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 305
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 #165 from Azure/add_github_actions
Add bikes pr workflow and bikesharing workflow for GitHub Actions
- Loading branch information
Showing
2 changed files
with
108 additions
and
0 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,51 @@ | ||
name: PRFlow Bikes | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- samples/BikeSharingApp/Bikes/* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@master | ||
|
||
- uses: azure/container-actions/docker-login@master | ||
with: | ||
login-server: ${{ secrets.CONTAINER_REGISTRY }} | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- run: | | ||
docker build samples/BikeSharingApp/Bikes/ -t ${{ secrets.CONTAINER_REGISTRY }}/bikes:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/bikes:$GITHUB_SHA | ||
- uses: azure/k8s-actions/aks-set-context@master | ||
with: | ||
creds: '${{ secrets.AZURE_CREDENTIALS }}' | ||
cluster-name: ${{ secrets.CLUSTER_NAME }} | ||
resource-group: ${{ secrets.RESOURCE_GROUP }} | ||
|
||
- name: Create child namespaces and add Dev Spaces labels | ||
run: | | ||
if [ -n "$(kubectl get namespace $GITHUB_HEAD_REF --ignore-not-found -o name)" ]; then exit 0; fi | ||
kubectl create namespace $GITHUB_HEAD_REF | ||
kubectl label namespace $GITHUB_HEAD_REF azds.io/parent-space=${{ secrets.MASTER_SPACE }} | ||
kubectl label namespace $GITHUB_HEAD_REF azds.io/space=true | ||
- uses: azure/k8s-actions/k8s-create-secret@master | ||
with: | ||
namespace: ${{ github.head_ref }} | ||
container-registry-url: ${{ secrets.CONTAINER_REGISTRY }} | ||
container-registry-username: ${{ secrets.REGISTRY_USERNAME }} | ||
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }} | ||
secret-name: ${{ secrets.IMAGE_PULL_SECRET }} | ||
|
||
- name: Helm Install PR | ||
run: | | ||
helm upgrade --install --namespace $GITHUB_HEAD_REF bikesharing-$GITHUB_HEAD_REF samples/BikeSharingApp/Bikes/charts/bikes --set "image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikes,image.tag=$GITHUB_SHA,imagePullSecrets[0].name=${{ secrets.IMAGE_PULL_SECRET }},ingress.hosts[0]=$GITHUB_HEAD_REF.s.${{ secrets.MASTER_SPACE }}.bikesharing.${{ secrets.HOST_SUFFIX }},ingress.annotations.\"kubernetes\\.io/ingress\\.class\"=traefik-azds" | ||
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,57 @@ | ||
name: Master | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- samples/BikeSharingApp/** | ||
- "!**/*.md" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@master | ||
|
||
- uses: azure/container-actions/docker-login@master | ||
with: | ||
login-server: '${{ secrets.CONTAINER_REGISTRY }}' | ||
username: '${{ secrets.REGISTRY_USERNAME }}' | ||
password: '${{ secrets.REGISTRY_PASSWORD }}' | ||
|
||
- run: | | ||
docker build samples/BikeSharingApp/Bikes/ -t ${{ secrets.CONTAINER_REGISTRY }}/bikes:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/bikes:$GITHUB_SHA | ||
docker build samples/BikeSharingApp/BikeSharingWeb/ -t ${{ secrets.CONTAINER_REGISTRY }}/bikesharingweb:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/bikesharingweb:$GITHUB_SHA | ||
docker build samples/BikeSharingApp/Billing/ -t ${{ secrets.CONTAINER_REGISTRY }}/billing:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/billing:$GITHUB_SHA | ||
docker build samples/BikeSharingApp/Gateway/ -t ${{ secrets.CONTAINER_REGISTRY }}/gateway:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/gateway:$GITHUB_SHA | ||
docker build samples/BikeSharingApp/Reservation/ -t ${{ secrets.CONTAINER_REGISTRY }}/reservation:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/reservation:$GITHUB_SHA | ||
docker build samples/BikeSharingApp/ReservationEngine/ -t ${{ secrets.CONTAINER_REGISTRY }}/reservationengine:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/reservationengine:$GITHUB_SHA | ||
docker build samples/BikeSharingApp/Users/ -t ${{ secrets.CONTAINER_REGISTRY }}/users:$GITHUB_SHA | ||
docker push ${{ secrets.CONTAINER_REGISTRY }}/users:$GITHUB_SHA | ||
- uses: azure/k8s-actions/aks-set-context@master | ||
with: | ||
creds: '${{ secrets.AZURE_CREDENTIALS }}' | ||
cluster-name: '${{ secrets.CLUSTER_NAME }}' | ||
resource-group: '${{ secrets.RESOURCE_GROUP }}' | ||
|
||
- name: Helm Install Master | ||
run: | | ||
cd samples/BikeSharingApp/charts | ||
helm init --client-only | ||
helm dependency update | ||
helm upgrade --install --namespace ${{ secrets.MASTER_SPACE }} bikesharing . --set "bikes.image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikes, bikesharingweb.image.repository=${{ secrets.CONTAINER_REGISTRY }}/bikesharingweb, billing.image.repository=${{ secrets.CONTAINER_REGISTRY }}/billing, gateway.image.repository=${{ secrets.CONTAINER_REGISTRY }}/gateway, reservation.image.repository=${{ secrets.CONTAINER_REGISTRY }}/reservation, reservationengine.image.repository=${{ secrets.CONTAINER_REGISTRY }}/reservationengine, users.image.repository=${{ secrets.CONTAINER_REGISTRY }}/users, image.tag=$GITHUB_SHA" |