diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 574ef260..12a493e0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,43 +7,114 @@ on: description: 'Service to build and deploy' required: true default: 'aries-endorser-agent' - default: 'aries-endorser-git-agent' - git_repo_url: + endorser_agent_git_repo_url: description: 'Git repository URL' required: true default: 'hyperledger/aries-endorser-service' - git_ref: + endorser_agent_git_ref: description: 'Git reference (branch or tag)' required: false default: '' - docker_file_path: + endorser_agent_docker_file_path: description: 'Path to Dockerfile' required: true default: 'Dockerfile.acapy' - source_context_dir: + endorser_agent_source_context_dir: description: 'Source context directory for the build' required: true default: 'docker/acapy' - source_image_registry: + endorser_agent_source_image_registry: description: 'Source image registry' required: false default: '' - source_image_name: + endorser_agent_source_image_name: description: 'Source image name' required: false default: '' - source_image_tag: + endorser_agent_source_image_tag: description: 'Source image tag' required: false default: '' - registry_username_secret_name: + endorser_agent_registry_username_secret_name: description: 'Secret name for registry username' required: false default: 'ARTIFACTORY_USERNAME' - registry_password_secret_name: + endorser_agent_registry_password_secret_name: description: 'Secret name for registry password' required: false default: 'ARTIFACTORY_PASSWORD' + endorser_db_git_repo_url: + description: 'Git repository URL' + required: true + default: 'hyperledger/aries-endorser-service' + endorser_db_git_ref: + description: 'Git reference (branch or tag)' + required: false + default: '' + endorser_db_docker_file_path: + description: 'Path to Dockerfile' + required: true + default: 'Dockerfile.acapy' + endorser_db_source_context_dir: + description: 'Source context directory for the build' + required: true + default: 'docker/acapy' + endorser_db_source_image_registry: + description: 'Source image registry' + required: false + default: '' + endorser_db_source_image_name: + description: 'Source image name' + required: false + default: '' + endorser_db_source_image_tag: + description: 'Source image tag' + required: false + default: '' + endorser_db_registry_username_secret_name: + description: 'Secret name for registry username' + required: false + default: 'ARTIFACTORY_USERNAME' + endorser_db_registry_password_secret_name: + description: 'Secret name for registry password' + required: false + default: 'ARTIFACTORY_PASSWORD' + endorser_backup_git_repo_url: + description: 'Git repository URL' + required: true + default: 'hyperledger/aries-endorser-service' + endorser_backup_git_ref: + description: 'Git reference (branch or tag)' + required: false + default: '' + endorser_backup_docker_file_path: + description: 'Path to Dockerfile' + required: true + default: 'Dockerfile.acapy' + endorser_backup_source_context_dir: + description: 'Source context directory for the build' + required: true + default: 'docker/acapy' + endorser_backup_source_image_registry: + description: 'Source image registry' + required: false + default: '' + endorser_backup_source_image_name: + description: 'Source image name' + required: false + default: '' + endorser_backup_source_image_tag: + description: 'Source image tag' + required: false + default: '' + endorser_backup_registry_username_secret_name: + description: 'Secret name for registry username' + required: false + default: 'ARTIFACTORY_USERNAME' + endorser_backup_registry_password_secret_name: + description: 'Secret name for registry password' + required: false + default: 'ARTIFACTORY_PASSWORD' push: branches: - enhancement @@ -68,7 +139,7 @@ jobs: matrix: include: - service: aries-endorser-agent - GIT_REPO_URL: hyperledger/aries-endorser-service + GIT_REPO_URL: ${{ github.event.inputs.endorser_agent_git_repo_url || 'hyperledger/aries-endorser-service' }} GIT_REF: "" DOCKER_FILE_PATH: Dockerfile.acapy # The docker path, file, is the relative path to the docker file from the root of the repo. SOURCE_CONTEXT_DIR: docker/acapy # The context dir, context, sets the context for the build. i.e. where the build will source files from @@ -175,8 +246,9 @@ jobs: - name: Extract Tags id: extract if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - run: echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | grep -oE ':([^[:space:]]+)' | sed '/enhancement/d' | sed 's/://g' | tr '\n' ' ')" >> $GITHUB_OUTPUT - + run: | + echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | grep -oE ':([^[:space:]]+)' | sed '/enhancement/d' | sed 's/://g' | tr '\n' ' ')" >> $GITHUB_OUTPUT + single_tag=$( cut -d " " -f 1 << "$tags" ) >> $GITHUB_OUTPUT - name: Pull database image if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) run: | @@ -198,8 +270,8 @@ jobs: id: apply_labels if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) run: | - echo "FROM "docker tag "${{ matrix.SOURCE_IMAGE_REGISTRY }}${{ matrix.SOURCE_IMAGE_NAME }}:${{ matrix.SOURCE_IMAGE_TAG }}" "${{ matrix.SERVICE }}:${{ steps.extract.outputs.tags }}" - docker push "${{ matrix.SERVICE }}:${{ steps.extract.outputs.tags }}" + echo "FROM ${{ steps.build_image.outputs.image }}:${{ steps.extract.outputs.single_tag }} | --label ca.bc.gov.digitaltrust.build.source-location=${{ github.repositoryUrl }} --label ca.bc.gov.digitaltrust.build.commit.id=${{ github.sha }} - + - name: Push database image id: push