Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gissebass committed Nov 9, 2024
1 parent 7a90d33 commit 7a181f5
Showing 1 changed file with 51 additions and 52 deletions.
103 changes: 51 additions & 52 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,56 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Azure CLI Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Log in to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Build and push Docker image to ACR
run: |
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }} .
docker push ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }}
- name: Delete existing container instances
run: |
for i in 1 2 3; do
az container delete \
--name hilfling-backend${i} \
--resource-group hilfling-backend_group \
--yes || true
done
- name: Deploy new container instances
run: |
for i in 1 2 3; do
az container create \
--name hilfling-backend${i} \
--resource-group hilfling-backend_group \
--registry-username ${{ secrets.ACR_USERNAME }} \
--registry-password ${{ secrets.ACR_PASSWORD }} \
--image ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }} \
--cpu 1 --memory 2 \
--environment-variables DATABASE_USERNAME=${{ secrets.HILFLINGDB_USERNAME }} \
DATABASE_URL=${{ secrets.HILFLINGDB_URL_DEV }} \
DATABASE_PASSWORD=${{ secrets.HILFLINGDB_PASSWORD }} \
--ports 8000 \
--dns-name-label hilfling-backend${i}-dns \
--location norwayeast
done
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Azure CLI Login
# uses: azure/login@v2
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
#
# - name: Log in to Azure Container Registry
# uses: azure/docker-login@v1
# with:
# login-server: ${{ secrets.ACR_LOGIN_SERVER }}
# username: ${{ secrets.ACR_USERNAME }}
# password: ${{ secrets.ACR_PASSWORD }}
#
# - name: Build and push Docker image to ACR
# run: |
# docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }} .
# docker push ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }}
#
# - name: Delete existing container instances
# run: |
# for i in 1 2 3; do
# az container delete \
# --name hilfling-backend${i} \
# --resource-group hilfling-backend_group \
# --yes || true
# done
#
# - name: Deploy new container instances
# run: |
# for i in 1 2 3; do
# az container create \
# --name hilfling-backend${i} \
# --resource-group hilfling-backend_group \
# --registry-username ${{ secrets.ACR_USERNAME }} \
# --registry-password ${{ secrets.ACR_PASSWORD }} \
# --image ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }} \
# --cpu 1 --memory 2 \
# --environment-variables DATABASE_USERNAME=${{ secrets.HILFLINGDB_USERNAME }} \
# DATABASE_URL=${{ secrets.HILFLINGDB_URL_DEV }} \
# DATABASE_PASSWORD=${{ secrets.HILFLINGDB_PASSWORD }} \
# --ports 8000 \
# --dns-name-label hilfling-backend${i}-dns \
# --location norwayeast
# done
#
- name: Check and Create Application Gateway if it does not exist
run: |
if ! az network application-gateway show --name hilfling-gateway --resource-group hilfling-backend_group &>/dev/null; then
Expand All @@ -73,8 +73,7 @@ jobs:
--frontend-port 80 \
--http-settings-port 8000 \
--http-settings-protocol Http \
--frontend-ip-name hilfling-frontend-ip \
--frontend-ip-private-ip \
--public-ip-address hilfling-backend-ip \
--routing-rule-type Basic \
--backend-addresses hilfling-backend1-dns.norwayeast.azurecontainer.io hilfling-backend2-dns.norwayeast.azurecontainer.io hilfling-backend3-dns.norwayeast.azurecontainer.io
fi
Expand Down

0 comments on commit 7a181f5

Please sign in to comment.