{"id":5910094,"name":"bucketplace/opsmon-ecr-action","ecosystem":"actions","description":"Create Docker images and push into a ECR repository.","homepage":"","licenses":null,"normalized_licenses":[],"repository_url":"https://github.com/bucketplace/opsmon-ecr-action","keywords_array":["eng-devops"],"namespace":"bucketplace","versions_count":2,"first_release_published_at":"2022-04-26T04:54:09.000Z","latest_release_published_at":"2022-04-26T06:37:47.000Z","latest_release_number":"v1.1","last_synced_at":"2026-01-08T21:53:13.330Z","created_at":"2023-01-20T00:01:52.296Z","updated_at":"2026-09-13T04:19:08.123Z","registry_url":"https://github.com/bucketplace/opsmon-ecr-action","install_command":null,"documentation_url":null,"metadata":{"name":"aws-ecr-action","description":"Create Docker images and push into a ECR repository.","author":"jambam \u003chs.cho@bucketplace.net\u003e","inputs":{"access_key_id":{"description":"The AWS access key id","required":true},"secret_access_key":{"description":"The AWS secret access key","required":true},"account_id":{"description":"AWS Account ID","required":true},"app_name":{"description":"name of application","required":true},"registry_ids":{"description":"A comma-delimited list of AWS account IDs that are associated with the ECR registries. If you do not specify a registry, the default ECR registry is assumed","required":false,"default":""},"assume_role":{"description":"A role to assume under the account_id account.","required":false,"default":""},"region":{"description":"The AWS region","required":true},"create_repo":{"description":"Set this to true to create the repository if it does not already exist","required":false,"default":"false"},"set_repo_policy":{"description":"Set this to true to set a policy on the repository","required":false,"default":"false"},"repo_policy_file":{"description":"Set this to repository policy statement json file. only used if the set_repo_policy is set to true","required":false,"default":"repo-policy.json"},"tags":{"description":"Comma-separated string of ECR image tags","required":false,"default":"latest"},"image_scanning_configuration":{"description":"Set this to True if you want AWS to scan your images for vulnerabilities","required":false,"default":"false"},"dockerfile":{"description":"Name of Dockerfile to use","required":false,"default":"Dockerfile"},"extra_build_args":{"description":"Extra flags to pass to docker build (see docs.docker.com/engine/reference/commandline/build)","required":false,"default":""},"cache_from":{"description":"Images to use as cache for the docker build (see `--cache-from` argument docs.docker.com/engine/reference/commandline/build)","required":false,"default":""},"path":{"description":"Path to Dockerfile, defaults to the working directory","required":false,"default":"."},"prebuild_script":{"description":"Relative path from top-level to script to run before Docker build","required":false}},"outputs":{"image":{"value":"${{ steps.main.outputs.image }}","description":"The created image name"}},"runs":{"using":"composite","steps":[{"name":"Install aws-cli","uses":"unfor19/install-aws-cli-action@v1"},{"name":"Get Namespace","shell":"bash","id":"get-namespace","run":"echo \"::set-output name=namespace::$(curl -s \"https://ops.co-workerhou.se/api/v1/applications/${{ inputs.app_name }}/\" | jq -r '.namespace')\"\n"},{"name":"Run scripts","shell":"bash","id":"main","env":{"INPUT_ACCESS_KEY_ID":"${{ inputs.access_key_id }}","INPUT_SECRET_ACCESS_KEY":"${{ inputs.secret_access_key }}","INPUT_ACCOUNT_ID":"${{ inputs.account_id }}","INPUT_REGISTRY_IDS":"${{ inputs.registry_ids }}","INPUT_ASSUME_ROLE":"${{ inputs.assume_role }}","GET_NAMESPACE":"${{ steps.get-namespace.outputs.namespace }}","INPUT_REPO":"${{ steps.get-namespace.outputs.namespace }}/${{ inputs.app_name }}","INPUT_REGION":"${{ inputs.region }}","INPUT_CREATE_REPO":"${{ inputs.create_repo }}","INPUT_SET_REPO_POLICY":"${{ inputs.set_repo_policy }}","INPUT_REPO_POLICY_FILE":"${{ inputs.repo_policy_file }}","INPUT_TAGS":"${{ inputs.tags }}","INPUT_IMAGE_SCANNING_CONFIGURATION":"${{ inputs.image_scanning_configuration }}","INPUT_DOCKERFILE":"${{ inputs.dockerfile }}","INPUT_EXTRA_BUILD_ARGS":"${{ inputs.extra_build_args }}","INPUT_CACHE_FROM":"${{ inputs.cache_from }}","INPUT_PATH":"${{ inputs.path }}","INPUT_PREBUILD_SCRIPT":"${{ inputs.prebuild_script }}"},"run":"INPUT_PATH=\"${INPUT_PATH:-.}\"\nINPUT_DOCKERFILE=\"${INPUT_DOCKERFILE:-Dockerfile}\"\nINPUT_TAGS=\"${INPUT_TAGS:-latest}\"\nINPUT_CREATE_REPO=\"${INPUT_CREATE_REPO:-false}\"\nINPUT_SET_REPO_POLICY=\"${INPUT_SET_REPO_POLICY:-false}\"\nINPUT_REPO_POLICY_FILE=\"${INPUT_REPO_POLICY_FILE:-repo-policy.json}\"\nINPUT_IMAGE_SCANNING_CONFIGURATION=\"${INPUT_IMAGE_SCANNING_CONFIGURATION:-false}\"\nfunction main() {\n  sanitize \"${INPUT_ACCESS_KEY_ID}\" \"access_key_id\"\n  sanitize \"${INPUT_SECRET_ACCESS_KEY}\" \"secret_access_key\"\n  sanitize \"${INPUT_REGION}\" \"region\"\n  sanitize \"${INPUT_ACCOUNT_ID}\" \"account_id\"\n  ACCOUNT_URL=\"$INPUT_ACCOUNT_ID.dkr.ecr.$INPUT_REGION.amazonaws.com\"\n  aws_configure\n  assume_role\n  login\n  run_pre_build_script $INPUT_PREBUILD_SCRIPT\n  docker_build $INPUT_TAGS $ACCOUNT_URL\n  check_namespace\n  create_ecr_repo $INPUT_CREATE_REPO\n  set_ecr_repo_policy $INPUT_SET_REPO_POLICY\n  put_image_scanning_configuration $INPUT_IMAGE_SCANNING_CONFIGURATION\n  docker_push_to_ecr $INPUT_TAGS $ACCOUNT_URL\n}\nfunction sanitize() {\n  if [ -z \"${1}\" ]; then\n    \u003e\u00262 echo \"Unable to find the ${2}. Did you set with.${2}?\"\n    exit 1\n  fi\n}\nfunction aws_configure() {\n  export AWS_ACCESS_KEY_ID=$INPUT_ACCESS_KEY_ID\n  export AWS_SECRET_ACCESS_KEY=$INPUT_SECRET_ACCESS_KEY\n  export AWS_DEFAULT_REGION=$INPUT_REGION\n}\nfunction login() {\n  echo \"== START LOGIN\"\n  if [ \"${INPUT_REGISTRY_IDS}\" == \"\" ]; then\n    INPUT_REGISTRY_IDS=$INPUT_ACCOUNT_ID\n  fi\n  for i in ${INPUT_REGISTRY_IDS//,/ }\n  do\n    aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $i.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com\n  done\n  echo \"== FINISHED LOGIN\"\n}\nfunction assume_role() {\n  if [ \"${INPUT_ASSUME_ROLE}\" != \"\" ]; then\n    sanitize \"${INPUT_ASSUME_ROLE}\" \"assume_role\"\n    echo \"== START ASSUME ROLE\"\n    ROLE=\"arn:aws:iam::${INPUT_ACCOUNT_ID}:role/${INPUT_ASSUME_ROLE}\"\n    CREDENTIALS=$(aws sts assume-role --role-arn ${ROLE} --role-session-name ecrpush --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' --output text)\n    read id key token \u003c\u003c\u003c ${CREDENTIALS}\n    export AWS_ACCESS_KEY_ID=\"${id}\"\n    export AWS_SECRET_ACCESS_KEY=\"${key}\"\n    export AWS_SESSION_TOKEN=\"${token}\"\n    echo \"== FINISHED ASSUME ROLE\"\n  fi\n}\nfunction check_namespace() {\n  if [ \"${GET_NAMESPACE}\" == \"null\" ]; then\n    echo \"== Namespace does not exist! Please add namespace on Ops-Monster\"\n    exit 1\n  fi\n}\nfunction create_ecr_repo() {\n  if [ \"${1}\" = true ]; then\n    echo \"== START CREATE REPO\"\n    echo \"== CHECK REPO EXISTS\"\n    set +e\n    output=$(aws ecr describe-repositories --region $AWS_DEFAULT_REGION --repository-names $INPUT_REPO 2\u003e\u00261)\n    exit_code=$?\n    if [ $exit_code -ne 0 ]; then\n      if echo ${output} | grep -q RepositoryNotFoundException; then\n        echo \"== REPO DOESN'T EXIST, CREATING..\"\n        aws ecr create-repository --region $AWS_DEFAULT_REGION --repository-name $INPUT_REPO\n        echo \"== FINISHED CREATE REPO\"\n      else\n        \u003e\u00262 echo ${output}\n        exit $exit_code\n      fi\n    else\n      echo \"== REPO EXISTS, SKIPPING CREATION..\"\n    fi\n    set -e\n  fi\n}\nfunction set_ecr_repo_policy() {\n  if [ \"${1}\" = true ]; then\n    echo \"== START SET REPO POLICY\"\n    if [ -f \"${INPUT_REPO_POLICY_FILE}\" ]; then\n      aws ecr set-repository-policy --repository-name $INPUT_REPO --policy-text file://\"${INPUT_REPO_POLICY_FILE}\"\n      echo \"== FINISHED SET REPO POLICY\"\n    else\n      echo \"== REPO POLICY FILE (${INPUT_REPO_POLICY_FILE}) DOESN'T EXIST. SKIPPING..\"\n    fi\n  fi\n}\nfunction put_image_scanning_configuration() {\n  if [ \"${1}\" = true ]; then\n      echo \"== START SET IMAGE SCANNING CONFIGURATION\"\n    if [ \"${INPUT_IMAGE_SCANNING_CONFIGURATION}\" = true ]; then\n      aws ecr put-image-scanning-configuration --repository-name $INPUT_REPO --image-scanning-configuration scanOnPush=${INPUT_IMAGE_SCANNING_CONFIGURATION}\n      echo \"== FINISHED SET IMAGE SCANNING CONFIGURATION\"\n    fi\n  fi\n}\nfunction run_pre_build_script() {\n  if [ ! -z \"${1}\" ]; then\n    echo \"== START PREBUILD SCRIPT\"\n    chmod a+x $1\n    $1\n    echo \"== FINISHED PREBUILD SCRIPT\"\n  fi\n}\nfunction docker_build() {\n  echo \"== START DOCKERIZE\"\n  local TAG=$1\n  local docker_tag_args=\"\"\n  local DOCKER_TAGS=$(echo \"$TAG\" | tr \",\" \"\\n\")\n  for tag in $DOCKER_TAGS; do\n    docker_tag_args=\"$docker_tag_args -t $2/$INPUT_REPO:$tag\"\n  done\n  if [ -n \"${INPUT_CACHE_FROM}\" ]; then\n    for i in ${INPUT_CACHE_FROM//,/ }; do\n      docker pull $i\n    done\n    INPUT_EXTRA_BUILD_ARGS=\"$INPUT_EXTRA_BUILD_ARGS --cache-from=$INPUT_CACHE_FROM\"\n  fi\n  docker build $INPUT_EXTRA_BUILD_ARGS -f $INPUT_DOCKERFILE $docker_tag_args $INPUT_PATH\n  echo \"== FINISHED DOCKERIZE\"\n}\nfunction docker_push_to_ecr() {\n  echo \"== START PUSH TO ECR\"\n  local TAG=$1\n  local DOCKER_TAGS=$(echo \"$TAG\" | tr \",\" \"\\n\")\n  for tag in $DOCKER_TAGS; do\n    docker push $2/$INPUT_REPO:$tag\n    echo ::set-output name=image::$2/$INPUT_REPO:$tag\n  done\n  echo \"== FINISHED PUSH TO ECR\"\n}\nmain"}]},"default_branch":"main","path":null},"repo_metadata":{"uuid":"485296243","full_name":"bucketplace/opsmon-ecr-action","owner":"bucketplace","description":"This Action allows you to create Docker images and push into a ECR repository.","archived":false,"fork":false,"pushed_at":"2022-10-19T04:57:15.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-05-19T18:33:47.911Z","etag":null,"topics":["eng-devops"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bucketplace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-25T09:01:46.000Z","updated_at":"2022-10-18T14:37:56.000Z","dependencies_parsed_at":"2023-01-19T19:15:40.230Z","dependency_job_id":null,"html_url":"https://github.com/bucketplace/opsmon-ecr-action","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":0.08163265306122447,"last_synced_commit":"0099c63ef4b17a1bd5c7a6dc36f6f09a3347cd63"},"previous_names":[],"tags_count":2,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action/tags","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bucketplace","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":145452628,"owners_count":6247643,"icon_url":"https://github.com/github.png","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"},"owner_record":{"login":"bucketplace","name":"Bucketplace","uuid":"36986884","kind":"organization","description":"","email":null,"website":null,"location":null,"twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/36986884?v=4","repositories_count":11,"last_synced_at":"2023-03-04T22:52:52.285Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/bucketplace","created_at":"2022-11-15T02:07:16.680Z","updated_at":"2023-03-04T22:52:52.316Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bucketplace","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bucketplace/repositories"},"tags":[{"name":"v1.1","sha":"66dd49248fa2cc177e5085d186683ef4ca924541","kind":"commit","published_at":"2022-04-26T06:37:47.000Z","download_url":"https://codeload.github.com/bucketplace/opsmon-ecr-action/tar.gz/v1.1","html_url":"https://github.com/bucketplace/opsmon-ecr-action/releases/tag/v1.1","dependencies_parsed_at":"2023-05-31T10:01:03.778Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action/tags/v1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action/tags/v1.1/manifests"},{"name":"v1.0","sha":"a0d91c9fedc9f357f7d3c59c88f647f2e5103f37","kind":"commit","published_at":"2022-04-26T04:54:09.000Z","download_url":"https://codeload.github.com/bucketplace/opsmon-ecr-action/tar.gz/v1.0","html_url":"https://github.com/bucketplace/opsmon-ecr-action/releases/tag/v1.0","dependencies_parsed_at":"2023-05-31T10:01:04.126Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action/tags/v1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bucketplace%2Fopsmon-ecr-action/tags/v1.0/manifests"}]},"repo_metadata_updated_at":"2026-09-13T04:19:08.122Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":42.858974907023466,"dependent_packages_count":0.0,"stargazers_count":49.38656863164194,"forks_count":37.2590091052879,"average":32.376138160988326},"purl":"pkg:githubactions/bucketplace/opsmon-ecr-action","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/actions/bucketplace/opsmon-ecr-action","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/actions/bucketplace/opsmon-ecr-action","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/actions/bucketplace/opsmon-ecr-action/dependencies","status":"removed","funding_links":[],"critical":null,"issue_metadata":{"last_synced_at":"2023-08-09T09:49:41.827Z","issues_count":0,"pull_requests_count":3,"avg_time_to_close_issue":null,"avg_time_to_close_pull_request":7797015.333333333,"issues_closed_count":0,"pull_requests_closed_count":3,"pull_request_authors_count":1,"issue_authors_count":0,"avg_comments_per_issue":null,"avg_comments_per_pull_request":0.0,"merged_pull_requests_count":2,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":0,"past_year_pull_requests_count":0,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":0,"past_year_pull_request_authors_count":0,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":null,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":0},"versions_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/bucketplace%2Fopsmon-ecr-action/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/bucketplace%2Fopsmon-ecr-action/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/bucketplace%2Fopsmon-ecr-action/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/bucketplace%2Fopsmon-ecr-action/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/bucketplace%2Fopsmon-ecr-action/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/bucketplace%2Fopsmon-ecr-action/codemeta","maintainers":[]}