Adding tags to images

This commit is contained in:
Yanis JEDRZEJCZAK 2024-05-23 11:44:24 +02:00
parent 39cbbcda27
commit aff7d5e67e
3 changed files with 18 additions and 11 deletions

View File

@ -33,10 +33,13 @@ jobs:
username: nologin username: nologin
password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }} password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }} registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}
- name: Get Git Commit SHA
id: vars
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build the Docker Image - name: Build the Docker Image
run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }} run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
- name: Push the Docker Image to Scaleway Container Registry - name: Push the Docker Image to Scaleway Container Registry
run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }} run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
deploy-to-scaleway-lecoffre: deploy-to-scaleway-lecoffre:
needs: build-and-push-image-lecoffre needs: build-and-push-image-lecoffre
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -65,7 +68,7 @@ jobs:
fi fi
done <<< "$ENV_VARS" done <<< "$ENV_VARS"
env_string=$(echo $env_string | sed 's/ $//') env_string=$(echo $env_string | sed 's/ $//')
scw container container update ${{ env.CONTAINER_ID }} $env_string scw container container update ${{ env.CONTAINER_ID }} $env_string registry-image ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
env: env:
ENV_VARS: ${{ secrets.ENV }} ENV_VARS: ${{ secrets.ENV }}
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }} SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}

View File

@ -34,10 +34,13 @@ jobs:
username: nologin username: nologin
password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }} password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }} registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}
- name: Get Git Commit SHA
id: vars
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build the Docker Image - name: Build the Docker Image
run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }} run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
- name: Push the Docker Image to Scaleway Container Registry - name: Push the Docker Image to Scaleway Container Registry
run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }} run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
deploy-to-scaleway-lecoffre: deploy-to-scaleway-lecoffre:
needs: build-and-push-image-lecoffre needs: build-and-push-image-lecoffre
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -66,7 +69,7 @@ jobs:
fi fi
done <<< "$ENV_VARS" done <<< "$ENV_VARS"
env_string=$(echo $env_string | sed 's/ $//') env_string=$(echo $env_string | sed 's/ $//')
scw container container update ${{ env.CONTAINER_ID }} $env_string scw container container update ${{ env.CONTAINER_ID }} $env_string registry-image ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
env: env:
ENV_VARS: ${{ secrets.ENV }} ENV_VARS: ${{ secrets.ENV }}
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }} SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}

View File

@ -5,11 +5,9 @@ on:
branches: [staging] branches: [staging]
env: env:
PROJECT_ID_LECOFFRE: 72d08499-37c2-412b-877e-f8af0471654a PROJECT_ID_LECOFFRE: 72d08499-37c2-412b-877e-f8af0471654a
NAMESPACE_ID_LECOFFRE: f8137e85-47ad-46a5-9e2e-18af5de829c5 NAMESPACE_ID_LECOFFRE: f8137e85-47ad-46a5-9e2e-18af5de829c5
CONTAINER_REGISTRY_ENDPOINT_LECOFFRE: rg.fr-par.scw.cloud/funcscwlecoffrestgbqbfhtv6 CONTAINER_REGISTRY_ENDPOINT_LECOFFRE: rg.fr-par.scw.cloud/funcscwlecoffrestgbqbfhtv6
IMAGE_NAME: front IMAGE_NAME: front
CONTAINER_NAME: front CONTAINER_NAME: front
@ -34,10 +32,13 @@ jobs:
username: nologin username: nologin
password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }} password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }} registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}
- name: Get Git Commit SHA
id: vars
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build the Docker Image - name: Build the Docker Image
run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }} run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
- name: Push the Docker Image to Scaleway Container Registry - name: Push the Docker Image to Scaleway Container Registry
run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }} run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
deploy-to-scaleway-lecoffre: deploy-to-scaleway-lecoffre:
needs: build-and-push-image-lecoffre needs: build-and-push-image-lecoffre
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -66,7 +67,7 @@ jobs:
fi fi
done <<< "$ENV_VARS" done <<< "$ENV_VARS"
env_string=$(echo $env_string | sed 's/ $//') env_string=$(echo $env_string | sed 's/ $//')
scw container container update ${{ env.CONTAINER_ID }} $env_string scw container container update ${{ env.CONTAINER_ID }} $env_string registry-image ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
env: env:
ENV_VARS: ${{ secrets.ENV }} ENV_VARS: ${{ secrets.ENV }}
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }} SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}