From cc7db95c72f894b793f68b35f00b3e7f1dbf2ac3 Mon Sep 17 00:00:00 2001
From: Matt Wise <wsmatth@amazon.com>
Date: Tue, 1 Sep 2020 13:38:23 -0500
Subject: [PATCH] use env var for code artifact domain. dynamically use current
 account as repo owner

---
 provider/legal-aws/build-aws/buildspec.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/provider/legal-aws/build-aws/buildspec.yaml b/provider/legal-aws/build-aws/buildspec.yaml
index 938d62753..a247ac98d 100644
--- a/provider/legal-aws/build-aws/buildspec.yaml
+++ b/provider/legal-aws/build-aws/buildspec.yaml
@@ -31,7 +31,8 @@ phases:
       - echo $JAVA_HOME #WHY
       - mkdir -p /root/.m2
       - cp ./provider/legal-aws/maven/settings.xml /root/.m2/settings.xml # copy the AWS-specific settings.xml to the CodeBuild instance's .m2 folder
-      - export AWS_OSDU_DEV_MAVEN_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain osdu-dev --domain-owner 888733619319 --query authorizationToken --output text`
+      - export AWS_ACCOUNT_ID=`aws sts get-caller-identity | grep Account | cut -d':' -f 2 | cut -d'"' -f 2`
+      - export AWS_OSDU_DEV_MAVEN_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain $AWS_OSDU_DEV_MAVEN_DOMAIN --domain-owner $AWS_ACCOUNT_ID --query authorizationToken --output text`
   pre_build:
     commands:
       - echo "Logging in to Amazon ECR..."
-- 
GitLab