From 9fba7f0ec7d0e4c831c80a4846963956d907ba7a Mon Sep 17 00:00:00 2001 From: andrea rota Date: Tue, 9 Apr 2024 10:50:29 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20use=20vars.blah,=20not=20env.blah=20?= =?UTF-8?q?=F0=9F=A4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-to-kubernetes.yml | 6 +-- .../publish-marxan-docker-images.yml | 42 +++++++++---------- .../publish-webshot-docker-images.yml | 10 ++--- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy-to-kubernetes.yml b/.github/workflows/deploy-to-kubernetes.yml index 5664351664..c025063903 100644 --- a/.github/workflows/deploy-to-kubernetes.yml +++ b/.github/workflows/deploy-to-kubernetes.yml @@ -78,7 +78,7 @@ jobs: - name: Add custom host data run: | - sudo sh -c 'echo "127.0.0.1 ${{ env.AZURE_AKS_HOST }}" >> /etc/hosts' + sudo sh -c 'echo "127.0.0.1 ${{ vars.AZURE_AKS_HOST }}" >> /etc/hosts' - name: Install kubectl uses: azure/setup-kubectl@v3 @@ -88,12 +88,12 @@ jobs: - name: Config kubectl run: | mkdir ~/.kube - az aks get-credentials --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --name ${{ env.AZURE_AKS_CLUSTER_NAME }} + az aks get-credentials --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_AKS_CLUSTER_NAME }} sed -i 's/\([[:alnum:]]\+\?.privatelink.[[:alnum:]]\+\?.azmk8s.io\):443/\1:4433/g' ~/.kube/config - name: Creating SSH tunnel run: | - ssh -i ~/.ssh/bastion.key -o StrictHostKeyChecking=no -N -L 4433:${{ env.AZURE_AKS_HOST }}:443 ${{ env.BASTION_USER }}@${{ env.BASTION_HOST }} -T & + ssh -i ~/.ssh/bastion.key -o StrictHostKeyChecking=no -N -L 4433:${{ vars.AZURE_AKS_HOST }}:443 ${{ vars.BASTION_USER }}@${{ vars.BASTION_HOST }} -T & - name: Redeploy production pods if: ${{ github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/publish-marxan-docker-images.yml b/.github/workflows/publish-marxan-docker-images.yml index e89e2eedbb..8ee94ee18f 100644 --- a/.github/workflows/publish-marxan-docker-images.yml +++ b/.github/workflows/publish-marxan-docker-images.yml @@ -67,15 +67,15 @@ jobs: - name: Build and push image uses: azure/docker-login@v1 with: - login-server: ${{ env.REGISTRY_LOGIN_SERVER }} - username: ${{ env.REGISTRY_USERNAME }} + login-server: ${{ vars.REGISTRY_LOGIN_SERVER }} + username: ${{ vars.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - run: | docker build ./api -f api/api.Dockerfile \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.sha }} \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} - docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-api + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.sha }} \ + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} + docker push -a ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-api push_geoprocessing_to_registry: name: Push Geoprocessing Docker image to Azure Container Registry @@ -95,15 +95,15 @@ jobs: - name: Build and push image uses: azure/docker-login@v1 with: - login-server: ${{ env.REGISTRY_LOGIN_SERVER }} - username: ${{ env.REGISTRY_USERNAME }} + login-server: ${{ vars.REGISTRY_LOGIN_SERVER }} + username: ${{ vars.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - run: | docker build ./api -f api/geo.Dockerfile \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.sha }} \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} - docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.sha }} \ + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} + docker push -a ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing push_client_to_registry: name: Push Client Docker image to Azure Container Registry @@ -124,19 +124,19 @@ jobs: - name: Build and push image uses: azure/docker-login@v1 with: - login-server: ${{ env.REGISTRY_LOGIN_SERVER }} - username: ${{ env.REGISTRY_USERNAME }} + login-server: ${{ vars.REGISTRY_LOGIN_SERVER }} + username: ${{ vars.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - run: | docker build ./app \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.sha }} \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} \ - --build-arg NEXT_PUBLIC_URL=${{ github.ref != 'refs/heads/main' && env.NEXT_PUBLIC_URL_STAGING || env.NEXT_PUBLIC_URL_PRODUCTION }} \ - --build-arg NEXT_PUBLIC_API_URL=${{ github.ref != 'refs/heads/main' && env.NEXT_PUBLIC_API_URL_STAGING || env.NEXT_PUBLIC_API_URL_PRODUCTION }} \ - --build-arg NEXTAUTH_URL=${{ github.ref != 'refs/heads/main' && env.NEXTAUTH_URL_STAGING || env.NEXTAUTH_URL_PRODUCTION }} \ - --build-arg NEXT_PUBLIC_FEATURE_FLAGS=${{ github.ref != 'refs/heads/main' && env.NEXT_PUBLIC_FEATURE_FLAGS_STAGING || env.NEXT_PUBLIC_FEATURE_FLAGS_PRODUCTION }} \ - --build-arg NEXT_PUBLIC_MAPBOX_API_TOKEN=${{ env.NEXT_PUBLIC_MAPBOX_API_TOKEN }} \ + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.sha }} \ + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} \ + --build-arg NEXT_PUBLIC_URL=${{ github.ref != 'refs/heads/main' && vars.NEXT_PUBLIC_URL_STAGING || vars.NEXT_PUBLIC_URL_PRODUCTION }} \ + --build-arg NEXT_PUBLIC_API_URL=${{ github.ref != 'refs/heads/main' && vars.NEXT_PUBLIC_API_URL_STAGING || vars.NEXT_PUBLIC_API_URL_PRODUCTION }} \ + --build-arg NEXTAUTH_URL=${{ github.ref != 'refs/heads/main' && vars.NEXTAUTH_URL_STAGING || vars.NEXTAUTH_URL_PRODUCTION }} \ + --build-arg NEXT_PUBLIC_FEATURE_FLAGS=${{ github.ref != 'refs/heads/main' && vars.NEXT_PUBLIC_FEATURE_FLAGS_STAGING || vars.NEXT_PUBLIC_FEATURE_FLAGS_PRODUCTION }} \ + --build-arg NEXT_PUBLIC_MAPBOX_API_TOKEN=${{ vars.NEXT_PUBLIC_MAPBOX_API_TOKEN }} \ --build-arg ENABLE_MAINTENANCE_MODE=${{ github.event.inputs.enable_maintenance_mode }} \ - --build-arg NEXT_PUBLIC_CONTACT_EMAIL=${{ env.NEXT_PUBLIC_CONTACT_EMAIL }} - docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-client + --build-arg NEXT_PUBLIC_CONTACT_EMAIL=${{ vars.NEXT_PUBLIC_CONTACT_EMAIL }} + docker push -a ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-client diff --git a/.github/workflows/publish-webshot-docker-images.yml b/.github/workflows/publish-webshot-docker-images.yml index c078523908..3210e692c0 100644 --- a/.github/workflows/publish-webshot-docker-images.yml +++ b/.github/workflows/publish-webshot-docker-images.yml @@ -34,12 +34,12 @@ jobs: - name: Build and push image uses: azure/docker-login@v1 with: - login-server: ${{ env.REGISTRY_LOGIN_SERVER }} - username: ${{ env.REGISTRY_USERNAME }} + login-server: ${{ vars.REGISTRY_LOGIN_SERVER }} + username: ${{ vars.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - run: | docker build ./webshot \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.sha }} \ - -t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} - docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-webshot + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.sha }} \ + -t ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} + docker push -a ${{ vars.REGISTRY_LOGIN_SERVER }}/marxan-webshot