From 01445135cf2acbe3240bf8b4cc6345ee480460e8 Mon Sep 17 00:00:00 2001 From: Lucas Rodriguez Date: Wed, 4 Oct 2023 01:39:02 -0500 Subject: [PATCH] Update the way github outputs are set --- .github/workflows/test-aws-init-package.yml | 7 ++++++- bootstrap/iam/iam.sh | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-aws-init-package.yml b/.github/workflows/test-aws-init-package.yml index 2f55132..c993128 100644 --- a/.github/workflows/test-aws-init-package.yml +++ b/.github/workflows/test-aws-init-package.yml @@ -75,7 +75,12 @@ jobs: - name: Create IAM roles for IRSA authentication working-directory: bootstrap/iam id: iam-create - run: ./iam.sh create ${{ inputs.cluster_name || 'zarf-init-aws-test' }} + run: | + ./iam.sh create ${{ inputs.cluster_name || 'zarf-init-aws-test' }} + + # Set the IAM role ARNs as GitHub Actions outputs + echo "{ecr-webhook-role-arn}={$ECR_WEBHOOK_ROLE_ARN}" >> "$GITHUB_OUTPUT" + echo "{ecr-credential-helper-role-arn}={$ECR_CREDENTIAL_HELPER_ROLE_ARN}" >> "$GITHUB_OUTPUT" - name: Zarf init with private ECR registry working-directory: ./build diff --git a/bootstrap/iam/iam.sh b/bootstrap/iam/iam.sh index 58c26da..e5015a3 100755 --- a/bootstrap/iam/iam.sh +++ b/bootstrap/iam/iam.sh @@ -36,9 +36,9 @@ create() { ECR_WEBHOOK_ROLE_ARN=$(aws iam create-role --role-name ecr-webhook --assume-role-policy-document file://ecr-webhook-role.json --query "Role.Arn" --output text) ECR_CREDENTIAL_HELPER_ROLE_ARN=$(aws iam create-role --role-name ecr-credential-helper --assume-role-policy-document file://ecr-credential-helper-role.json --query "Role.Arn" --output text) - # Set the IAM role ARNs as GitHub Actions outputs - echo "{ecr-webhook-role-arn}={$ECR_WEBHOOK_ROLE_ARN}" >> "$GITHUB_OUTPUT" - echo "{ecr-credential-helper-role-arn}={$ECR_CREDENTIAL_HELPER_ROLE_ARN}" >> "$GITHUB_OUTPUT" + # Export as env vars to be used as github outputs for zarf init + export ECR_WEBHOOK_ROLE_ARN + export ECR_CREDENTIAL_HELPER_ROLE_ARN # Attach policies to roles aws iam attach-role-policy --role-name ecr-webhook --policy-arn "$ECR_WEBHOOK_POLICY_ARN"