From c913e6538d88efaf1d6f0eb7742e7531d66a32c2 Mon Sep 17 00:00:00 2001
From: Eytan Dahan <eytan@captain-eye.com>
Date: Thu, 21 Nov 2024 08:29:46 +0000
Subject: [PATCH] fix(CodeArtifact): fix AWS CodeArtifact variant

---
 README.md                                       | 4 ++--
 templates/gitlab-ci-python-aws-codeartifact.yml | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index fb521cc..d3429c0 100644
--- a/README.md
+++ b/README.md
@@ -638,13 +638,13 @@ then set the required configuration.
 
 ```yaml
 include:
-  - component: $CI_SERVER_FQDN/to-be-continuous/python/gitlab-ci-python@7.3.2
+  - component: $CI_SERVER_FQDN/to-be-continuous/python/gitlab-ci-python@7.5.0
     # 2: set/override component inputs
     inputs:
       image: registry.hub.docker.com/library/python:3.12-slim
       pytest-enabled: true
 
-  - component: $CI_SERVER_FQDN/to-be-continuous/python/gitlab-ci-python-aws-ca@7.3.2
+  - component: $CI_SERVER_FQDN/to-be-continuous/python/gitlab-ci-python-aws-codeartifact@7.5.0
     inputs:
       aws-region: "us-east-1"
       aws-codeartifact-domain: "acme"
diff --git a/templates/gitlab-ci-python-aws-codeartifact.yml b/templates/gitlab-ci-python-aws-codeartifact.yml
index f95fd93..60baea0 100644
--- a/templates/gitlab-ci-python-aws-codeartifact.yml
+++ b/templates/gitlab-ci-python-aws-codeartifact.yml
@@ -35,7 +35,7 @@ variables:
 
 .codeartifact-pip-config:
   before_script:
-    - CODEARTIFACT_URL=https://aws:${CODEARTIFACT_AUTH_TOKEN}@${CODEARTIFACT_REPOSITORY_ENDPOINT#https://}simple
+    - CODEARTIFACT_URL=https://aws:${PYTHON_REPOSITORY_PASSWORD}@${PYTHON_REPOSITORY_URL#https://}simple
     - pip config set global.index-url $CODEARTIFACT_URL
 
 .python-base:
@@ -49,12 +49,13 @@ variables:
     AWS_JWT:
       aud: "$AWS_OIDC_AUD"
   variables:
-    CODEARTIFACT_AUTH_TOKEN: "@url@http://aws-auth-provider/codeartifact/auth/token"
-    CODEARTIFACT_REPOSITORY_ENDPOINT: "@url@http://aws-auth-provider/codeartifact/repository/endpoint?format=pypi"
+    PYTHON_REPOSITORY_USERNAME: aws
+    PYTHON_REPOSITORY_PASSWORD: "@url@http://aws-auth-provider/codeartifact/auth/token"
+    PYTHON_REPOSITORY_URL: "@url@http://aws-auth-provider/codeartifact/repository/endpoint?format=pypi"
     AWS_JWT: "$AWS_JWT"
   before_script:
-    - !reference [.codeartifact-pip-config:]
     - !reference [.python-scripts]
     - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
     - cd ${PYTHON_PROJECT_DIR}
     - guess_build_system
+    - !reference [.codeartifact-pip-config, before_script]
-- 
GitLab