Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Fix sed command and update github actions output syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Rodriguez committed Oct 4, 2023
1 parent 4cba597 commit 24e14dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bootstrap/iam/iam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ create() {
fi

# Replace the placeholder in the JSON files with the EKS Cluster ID
sed -i '' "s/{{EKS_CLUSTER_ID}}/$EKS_CLUSTER_ID/g" "ecr-webhook-role.json"
sed -i '' "s/{{EKS_CLUSTER_ID}}/$EKS_CLUSTER_ID/g" "ecr-credential-helper-role.json"
sed -i "s/{{EKS_CLUSTER_ID}}/$EKS_CLUSTER_ID/g" ecr-webhook-role.json
sed -i "s/{{EKS_CLUSTER_ID}}/$EKS_CLUSTER_ID/g" ecr-credential-helper-role.json

# Create IAM policies from JSON files
ECR_WEBHOOK_POLICY_ARN=$(aws iam create-policy --policy-name ecr-webhook --policy-document file://ecr-webhook-policy.json --query "Policy.Arn" --output text)
Expand All @@ -27,8 +27,8 @@ create() {
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 "::set-output name=ecr-webhook-role-arn::$ECR_WEBHOOK_ROLE_ARN"
echo "::set-output name=ecr-credential-helper-role-arn::$ECR_CREDENTIAL_HELPER_ROLE_ARN"
echo "{ecr-webhook-role-arn}={$ECR_WEBHOOK_ROLE_ARN}" >> "$GITHUB_OUTPUT"
echo "{ecr-credential-helper-role-arn}={$ECR_CREDENTIAL_HELPER_ROLE_ARN}" >> "$GITHUB_OUTPUT"

# Attach policies to roles
aws iam attach-role-policy --role-name ecr-webhook --policy-arn "$ECR_WEBHOOK_POLICY_ARN"
Expand Down
6 changes: 2 additions & 4 deletions zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ components:
required: true
files:
- source: bootstrap/ecr.sh
target: ./ecr-bootstrap.sh
target: bootstrap/ecr.sh
executable: true
actions:
onDeploy:
after:
- cmd: |
export REGISTRY_TYPE="$ZARF_VAR_REGISTRY_TYPE";
export AWS_REGION="$ZARF_VAR_AWS_REGION";
./ecr-bootstrap.sh
./bootstrap/ecr.sh
description: "Create ECR repository for the Pepr controller image"
- cmd: rm ./ecr-bootstrap.sh
description: "Cleanup the bootstrap script from disk"
- name: ecr-hook
description: "Pepr webhook that creates ECR repos for images during package deployments"
Expand Down

0 comments on commit 24e14dc

Please sign in to comment.