diff --git a/.github/workflows/ecr-handler.yaml b/.github/workflows/ecr-handler.yaml new file mode 100644 index 00000000..edf44e05 --- /dev/null +++ b/.github/workflows/ecr-handler.yaml @@ -0,0 +1,66 @@ +name: simple-ecr +on: + workflow_dispatch: + inputs: + tf_stack_destroy: + description: 'Destroy the Terraform stack' + required: false + type: boolean + default: true + aws_ecr_repo_name: + description: 'Name of the ECR repository' + required: true + type: string + default: ecr-repo + push: + branches: [ simple-ecr ] + +jobs: + simple-ecr: + runs-on: ubuntu-latest + steps: + - id: ecr-deploy + uses: bitovi/github-actions-deploy-aws-ecr-registry@v0.1.1 + # https://github.com/bitovi/github-actions-deploy-aws-ecr-registry/ + with: + aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} + aws_default_region: us-east-1 + + #aws_resource_identifier: + #aws_additional_tags: + + tf_stack_destroy: false #true + tf_state_bucket_destroy: true + aws_ecr_repo_force_destroy: true + #tf_state_file_name: + tf_state_file_name_append: ecr-registry + #tf_state_bucket: + #tf_stack_destroy: ${{ inputs.tf_stack_destroy }} + #tf_state_bucket_destroy: ${{ inputs.tf_stack_destroy }} + + aws_ecr_repo_create: true + aws_ecr_repo_type: private # default + aws_ecr_repo_name: ${{ inputs.aws_ecr_repo_name }} + aws_ecr_repo_mutable: true + aws_ecr_repo_encryption_type: AES256 + #aws_ecr_repo_encryption_key_arn: + #aws_ecr_repo_force_destroy: ${{ inputs.tf_stack_destroy }} + #aws_ecr_repo_force_destroy: ${{ inputs.tf_stack_destroy }} + aws_ecr_repo_image_scan: true #default + #aws_ecr_registry_scan_rule: + #aws_ecr_registry_pull_through_cache_rules: + #aws_ecr_registry_scan_config: + #aws_ecr_registry_replication_rules_input: + #aws_ecr_repo_policy_attach: + #aws_ecr_repo_policy_create: + #aws_ecr_repo_policy_input: + #aws_ecr_repo_read_arn: + #aws_ecr_repo_write_arn: + #aws_ecr_repo_read_arn_lambda: + #aws_ecr_lifecycle_policy_input: + #aws_ecr_public_repo_catalog: + #aws_ecr_registry_policy_input: + #aws_ecr_additional_tags: + # Lifecycle policy for automatic cleanup + aws_ecr_lifecycle_policy_input: '{\"rules\":[{\"rulePriority\":1,\"description\":\"Keep-last-10-production\",\"selection\":{\"tagStatus\":\"tagged\",\"tagPrefixList\":[\"production\"],\"countType\":\"imageCountMoreThan\",\"countNumber\":10},\"action\":{\"type\":\"expire\"}},{\"rulePriority\":2,\"description\":\"Keep-last-5-staging\",\"selection\":{\"tagStatus\":\"tagged\",\"tagPrefixList\":[\"staging\"],\"countType\":\"imageCountMoreThan\",\"countNumber\":5},\"action\":{\"type\":\"expire\"}},{\"rulePriority\":3,\"description\":\"Delete-untagged-older-than-10-days\",\"selection\":{\"tagStatus\":\"untagged\",\"countType\":\"sinceImagePushed\",\"countUnit\":\"days\",\"countNumber\":10},\"action\":{\"type\":\"expire\"}}]}' diff --git a/.github/workflows/jira-destroy.yaml b/.github/workflows/jira-destroy.yaml deleted file mode 100644 index d558d1ea..00000000 --- a/.github/workflows/jira-destroy.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Jira-destroy -on: - workflow_dispatch: - inputs: - aws_resource_identifier: -jobs: - destroy: - runs-on: ubuntu-latest - steps: - - id: destroy - name: Destroy - uses: bitovi/github-actions-deploy-docker-to-ec2@v0.4-delete - with: - aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_JIRA_INTEGRATIONS}} - aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_JIRA_INTEGRATIONS}} - aws_default_region: us-east-1 - aws_resource_identifier: ${{ github.event.inputs.aws_resource_identifier }} - - - stack_destroy: "true" - tf_state_bucket_destroy: true - - # Provide a secret called `DOT_ENV` to append environment variables to the .env file - dot_env: ${{ secrets.DOT_ENV }} - - domain_name: bitovi-jira.com - app_port: 3000 diff --git a/.github/workflows/v5-destroy.yaml b/.github/workflows/v5-destroy.yaml deleted file mode 100644 index a604f533..00000000 --- a/.github/workflows/v5-destroy.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: v0.5-destroy -on: - workflow_dispatch: - inputs: - aws_resource_identifier: -jobs: - destroy: - runs-on: ubuntu-latest - steps: - - id: destroy - name: Destroy - uses: bitovi/github-actions-deploy-docker-to-ec2@v0.5-delete - with: - aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX }} - aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX }} - aws_default_region: us-east-1 - aws_resource_identifier: ${{ github.event.inputs.aws_resource_identifier }} - - stack_destroy: "true" - tf_state_bucket_destroy: true \ No newline at end of file