From 5fde4584f1fa4b80e73265b6012d18ef2ad30d01 Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Wed, 17 Apr 2024 12:07:21 -0700 Subject: [PATCH] DUPLO-16826 Add amazon-ecr-credential-helper part 1 This adds the credential helper to Ubuntu 20, 22 and AmazonLinux2 flavor builds. However, it does not yet exclude this being added to the GCP build which is unnecessary in that context. This will enable testing the addition for AMIs. --- .github/workflows/build-image.yaml | 8 ++++---- AgentAmazonLinux2/Setup.sh | 8 ++++++-- AgentUbuntu20/Setup.sh | 6 ++++-- AgentUbuntu22/Setup.sh | 8 ++++++-- AgentUbuntu22/SetupPython3.sh | 8 ++++++-- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index a5a3c7c..72e5c9c 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -42,7 +42,7 @@ jobs: # AWS credentials - name: Packer AWS Role - uses: aws-actions/configure-aws-credentials@v3 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} @@ -105,7 +105,7 @@ jobs: # Upload the image manifest - name: Attach Manifest - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packer-manifest.json path: packer-manifest.json @@ -117,7 +117,7 @@ jobs: duplo_token: "${{ secrets.GOVCLOUD_DUPLO_TOKEN }}" steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # AWS credentials - name: Tenant AWS JIT @@ -127,7 +127,7 @@ jobs: # AWS credentials - name: Packer AWS Role - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} diff --git a/AgentAmazonLinux2/Setup.sh b/AgentAmazonLinux2/Setup.sh index f0291e2..4435473 100755 --- a/AgentAmazonLinux2/Setup.sh +++ b/AgentAmazonLinux2/Setup.sh @@ -84,7 +84,7 @@ ubuntuInstall () { } -installDependancies () { +installDependencies () { if [ "$OS" = "centos" ]; then echo "Centos Installing docker" @@ -115,6 +115,8 @@ installDependancies () { sudo amazon-linux-extras install -q -y docker sudo yum install -q -y docker sudo usermod -a -G docker ec2-user + sudo yum install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json sudo yum install -q -y git wget curl net-tools vim sudo yum install -q -y yum-utils @@ -139,6 +141,8 @@ installDependancies () { echo "Ubuntu Installing Container Management Service" sudo apt-get update sudo apt install -q -y python3-dev python3-pip bridge-utils python3-virtualenv gcc + sudo apt install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json ### options=`cat /etc/default/docker | grep bridge` echo $options @@ -197,7 +201,7 @@ echo "Step 1: Install Docker and setup docker bridge"; echo "--------------------------OS=$OS VER=$VER-------------------------------------1" echo; echo; -installDependancies +installDependencies diff --git a/AgentUbuntu20/Setup.sh b/AgentUbuntu20/Setup.sh index 3d0ef6b..e317992 100755 --- a/AgentUbuntu20/Setup.sh +++ b/AgentUbuntu20/Setup.sh @@ -83,7 +83,7 @@ ubuntuInstall () { } -installDependancies () { +installDependencies () { if [ "$OS" = "centos" ]; then echo "Centos Installing docker" @@ -112,6 +112,8 @@ installDependancies () { echo "Ubuntu Installing Container Management Service" sudo apt-get update sudo apt install -q -y python3-dev python3-pip bridge-utils python3-virtualenv gcc + sudo apt install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json ### options=`cat /etc/default/docker | grep bridge` echo $options @@ -165,7 +167,7 @@ echo "Step 1: Install Docker and setup docker bridge"; echo "--------------------------OS=$OS VER=$VER-------------------------------------1" echo; echo; -installDependancies +installDependencies diff --git a/AgentUbuntu22/Setup.sh b/AgentUbuntu22/Setup.sh index 9d29c98..0562d1d 100755 --- a/AgentUbuntu22/Setup.sh +++ b/AgentUbuntu22/Setup.sh @@ -85,7 +85,7 @@ ubuntuInstall () { } -installDependancies () { +installDependencies () { if [ "$OS" = "centos" ]; then echo "Centos Installing docker" @@ -116,6 +116,8 @@ installDependancies () { sudo amazon-linux-extras install -q -y docker sudo yum install -q -y docker sudo usermod -a -G docker ec2-user + sudo yum install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json sudo yum install -q -y git wget curl net-tools vim sudo yum install -q -y yum-utils @@ -140,6 +142,8 @@ installDependancies () { echo "Ubuntu Installing Container Management Service" sudo apt-get update sudo apt install -q -y python3-dev python3-pip bridge-utils python3-virtualenv gcc + sudo apt install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json ### options=`cat /etc/default/docker | grep bridge` @@ -205,7 +209,7 @@ echo "Step 1: Install Docker and setup docker bridge"; echo "--------------------------OS=$OS VER=$VER-------------------------------------1" echo; echo; -installDependancies +installDependencies diff --git a/AgentUbuntu22/SetupPython3.sh b/AgentUbuntu22/SetupPython3.sh index bc85b3b..a23b50a 100644 --- a/AgentUbuntu22/SetupPython3.sh +++ b/AgentUbuntu22/SetupPython3.sh @@ -88,7 +88,7 @@ ubuntuInstall () { } -installDependancies () { +installDependencies () { if [ "$OS" = "centos" ]; then echo "Centos Installing docker" @@ -119,6 +119,8 @@ installDependancies () { sudo amazon-linux-extras install -q -y docker sudo yum install -q -y docker sudo usermod -a -G docker ec2-user + sudo yum install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json sudo yum install -q -y git wget curl net-tools vim sudo yum install -q -y yum-utils @@ -143,6 +145,8 @@ installDependancies () { echo "Ubuntu Installing Container Management Service" sudo apt-get update sudo apt install -q -y python3-dev python3-pip bridge-utils python3-virtualenv gcc + sudo apt install -q -y amazon-ecr-credential-helper + mkdir -p ~/.docker && echo '{ "credsStore": "ecr-login" }' > ~/.docker/config.json ### options=`cat /etc/default/docker | grep bridge` @@ -208,7 +212,7 @@ echo "Step 1: Install Docker and setup docker bridge"; echo "--------------------------OS=$OS VER=$VER-------------------------------------1" echo; echo; -installDependancies +installDependencies