Skip to content

Commit

Permalink
chore: update repo link (#12)
Browse files Browse the repository at this point in the history
* chore: update repo link to image link
  • Loading branch information
amohamedhey authored May 24, 2024
1 parent 363ccbf commit 29eee8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ inputs:
pr-number:
description: The current pull request number
required: true
sso-prefix:
description: The prefix for the SSO account
required: true
sso-role:
description: The role to assume in the SSO account
required: true

runs:
using: 'composite'
Expand Down Expand Up @@ -74,3 +80,5 @@ runs:
ECR_REPO_TAG: ${{ inputs.ecr-repo-tag }}
USE_ALPHA_REGISTRY: ${{ inputs.use-alpha }}
PR_NUMBER: ${{ inputs.pr-number }}
SSO_PREFIX: ${{ inputs.sso-prefix }}
SSO_ROLE: ${{ inputs.sso-role }}
6 changes: 5 additions & 1 deletion scripts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ check_env_var "ECR_REPO_NAME"
check_env_var "ECR_REPO_TAG"
check_env_var "PR_NUMBER"
check_env_var "USE_ALPHA_REGISTRY"
check_env_var "SSO_PREFIX"
check_env_var "SSO_ROLE"

if [[ "$(check_bool "${USE_ALPHA_REGISTRY}")" ]]; then
_scan_repo_name="alpha-image/${ECR_REPO_NAME}"
else
_scan_repo_name="image/${ECR_REPO_NAME}"
fi
_scan_repo_link="https://eu-central-1.console.aws.amazon.com/ecr/repositories/private/${AWS_ACCOUNT_ID}/${_scan_repo_name}"

_image_digest=$(aws --region "${AWS_REGION}" ecr describe-images --repository-name "${_scan_repo_name}" --image-ids imageTag="${ECR_REPO_TAG}" --query 'imageDetails[].imageDigest' --output text)
_scan_repo_link="https://${SSO_PREFIX}.awsapps.com/start/#/console?account_id=${AWS_ACCOUNT_ID}&role_name=${SSO_ROLE}&destination=https%3A%2F%2F${AWS_REGION}.console.aws.amazon.com%2Fecr%2Frepositories%2Fprivate%2F${AWS_ACCOUNT_ID}%2F${_scan_repo_name}%2F_%2Fimage%2F${_image_digest}%2Fdetails%3Fregion%3D${AWS_REGION}"

log_info "Fetching scan results from ECR"
log_debug "repo=\"${_scan_repo_name}\" | imageTag=\"${ECR_REPO_TAG}\""
Expand Down

0 comments on commit 29eee8a

Please sign in to comment.