Skip to content

Commit 882c2e4

Browse files
committed
fix(CI/CD): add env variable
1 parent 5b4213c commit 882c2e4

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/deploy-dev-unified.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
1919
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER_NAME }}
2020
GKE_ZONE: ${{ secrets.GKE_ZONE }}
21+
GCP_REGION: ${{ secrets.GCP_REGION }}
2122
IMAGE_NAME: tasks-app
2223
INSTANCE_NAME: tasks-mysql
2324

@@ -219,17 +220,21 @@ jobs:
219220
echo "📋 Repositories disponibles:"
220221
gcloud artifacts repositories list --project=$PROJECT_ID
221222
222-
# Récupérer les informations du repository (nom et région)
223-
REPO_INFO=$(gcloud artifacts repositories list --format="value(name,location)" --filter="format=DOCKER" --project=$PROJECT_ID | head -1)
223+
# Récupérer le nom du repository
224+
REPO_NAME=$(gcloud artifacts repositories list --format="value(name)" --filter="format=DOCKER" --project=$PROJECT_ID | head -1)
224225
225-
if [ -n "$REPO_INFO" ]; then
226-
# Extraire le nom et la région
227-
REPO_NAME=$(echo $REPO_INFO | cut -d' ' -f1)
228-
REPO_LOCATION=$(echo $REPO_INFO | cut -d' ' -f2)
226+
if [ -n "$REPO_NAME" ]; then
227+
# Utiliser la région depuis les secrets
228+
REPO_LOCATION=$GCP_REGION
229229
230-
# Construire l'URL complète pour Docker
230+
# Construire l'URL complète pour Docker (format correct)
231231
DOCKER_REGISTRY_URL="${REPO_LOCATION}-docker.pkg.dev/${PROJECT_ID}/${REPO_NAME}"
232232
233+
echo "Debug - REPO_NAME: $REPO_NAME"
234+
echo "Debug - REPO_LOCATION: $REPO_LOCATION (depuis secret)"
235+
echo "Debug - PROJECT_ID: $PROJECT_ID"
236+
echo "Debug - URL construite: $DOCKER_REGISTRY_URL"
237+
233238
echo "ARTIFACT_REGISTRY_URL=$DOCKER_REGISTRY_URL" >> $GITHUB_ENV
234239
echo "REGISTRY=$DOCKER_REGISTRY_URL" >> $GITHUB_ENV
235240
echo "✅ Artifact Registry trouvé: $DOCKER_REGISTRY_URL"

0 commit comments

Comments
 (0)