feat: add secrets baseline audit #28
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # Builds a multi-architecture image based on input path | |
| name: Build and Push Container Image | |
| on: | |
| # Temporary to get started... | |
| push: | |
| branches: ["feature/push-container-images"] | |
| workflow_dispatch: | |
| inputs: | |
| image: | |
| description: 'The image' | |
| type: string | |
| required: true | |
| version: | |
| description: 'The version to associate to the image' | |
| type: string | |
| required: true | |
| context: | |
| description: 'The build directory for the context of the build' | |
| type: string | |
| required: true | |
| file: | |
| description: 'The Dockerfile full path' | |
| type: string | |
| required: false | |
| workflow_call: | |
| inputs: | |
| image: | |
| description: 'The image' | |
| type: string | |
| required: true | |
| version: | |
| description: 'The version to associate to the image' | |
| type: string | |
| required: true | |
| context: | |
| description: 'The build directory for the context of the build' | |
| type: string | |
| required: true | |
| file: | |
| description: 'The Dockerfile full path' | |
| type: string | |
| required: false | |
| # jobs: | |
| # pass-secrets-to-workflow: | |
| # uses: ./.github/workflows/build-and-push-container-image.yml | |
| # secrets: inherit | |
| secrets: | |
| DOCKERHUB_USERNAME: | |
| description: 'The docker login' | |
| required: true | |
| DOCKERHUB_TOKEN: | |
| description: 'The docker token for the login' | |
| required: true | |
| AWS_ROLE_ARN_TO_ASSUME: | |
| description: 'The role to assume for the ECR repository' | |
| required: true | |
| BOT_GITHUB_TOKEN: | |
| description: 'The token for the bot user' | |
| required: true | |
| permissions: {} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| packages: write | |
| #if: (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - linux/amd64 | |
| - linux/arm64 | |
| steps: | |
| - name: Checkout repository | |
| id: checkout-repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Test Debugger Should be Empty | |
| if: hashFiles('./src/git-repo-research-mcp-server/Dockerfile') | |
| run: | | |
| echo "NOPE" | |
| - name: Test Dockerfile | |
| if: hashFiles(inputs.file || './src/git-repo-research-mcp-server/Dockerfile') | |
| run: | | |
| echo "YES" | |
| - name: Prepare | |
| run: | | |
| platform=${{ matrix.platform }} | |
| echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| #ADD LATER | |
| # 'public.ecr.aws/mcp/awslabs/${{ inputs.image || 'core-mcp-server' }} | |
| # ghcr.io/awslabs/mcp/awslabs/${{ inputs.image || 'core-mcp-server' }} | |
| images: | | |
| docker.io/awslabs/${{ inputs.image || 'core-mcp-server' }} | |
| # Disable all but the raw and sha | |
| tags: | | |
| type=schedule,enable=false | |
| type=semver,pattern={{raw}},enable=false | |
| type=pep440,pattern={{raw}},enable=false | |
| type=match,pattern=(.*),group=1,enable=false | |
| type=edge,enable=false | |
| type=ref,event=branch,enable=false | |
| type=ref,event=tag,enable=false | |
| type=ref,event=pr,enable=false | |
| type=sha,format=long,enable=true | |
| type=raw,value=latest,enable=true # {{is_default_branch}} doesn't work | |
| type=raw,value=${{ inputs.version || '0.0.0' }},enable=${{ inputs.version || 'false' }} | |
| labels: | | |
| maintainer=AWSLabs MCP | |
| org.opencontainers.image.description=Test Description | |
| org.opencontainers.image.source=https://github.com/awslabs/mcp/tree/main/src/${{ inputs.image || 'core-mcp-server' }} | |
| org.opencontainers.image.title=awslabs.${{ inputs.image || 'core-mcp-server' }} | |
| org.opencontainers.image.url=https://github.com/awslabs/mcp/tree/main/src/${{ inputs.image || 'core-mcp-server' }} | |
| org.opencontainers.image.version=${{ inputs.version || '0.0.0' }} | |
| org.opencontainers.image.vendor=Amazon Web Service, Inc. | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: awslabs-mcp # ${{ github.actor }} | |
| password: ${{ secrets.BOT_GITHUB_TOKEN }} | |
| # - name: Login to Public ECR | |
| # uses: docker/login-action@v3 | |
| # with: | |
| # registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com | |
| # registry: public.ecr.aws | |
| # username: ${{ vars.AWS_ACCESS_KEY_ID }} | |
| # password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # env: | |
| # AWS_REGION: <region> | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| buildkitd-flags: --debug | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: ${{ matrix.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| #tags: docker.io/${{ github.repository_owner }}/core-mcp-server,ghcr.io/${{ github.repository }}/core-mcp-server | |
| tags: docker.io/${{ github.repository_owner }}/${{ inputs.image || 'core-mcp-server' }} | |
| context: ${{ inputs.context || './src/core-mcp-server' }} | |
| file: ${{ inputs.file || './src/core-mcp-server/Dockerfile' }} | |
| push: true | |
| outputs: type=image,push-by-digest=true,name-canonical=true,push=true | |
| - name: Export digest | |
| run: | | |
| mkdir -p ${{ runner.temp }}/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-${{ env.PLATFORM_PAIR }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| merge: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| # if: (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') | |
| needs: | |
| - build | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: 'awslabs-mcp' | |
| password: ${{ secrets.BOT_GITHUB_TOKEN }} | |
| # - name: Login to Public ECR | |
| # uses: docker/login-action@v3 | |
| # with: | |
| # registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com | |
| # registry: public.ecr.aws | |
| # username: ${{ vars.AWS_ACCESS_KEY_ID }} | |
| # password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # env: | |
| # AWS_REGION: <region> | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| buildkitd-flags: --debug | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| #ADD LATER | |
| # public.ecr.aws/mcp/awslabs/${{ inputs.image || 'core-mcp-server' }} | |
| # ghcr.io/awslabs/mcp/awslabs/${{ inputs.image || 'core-mcp-server' }} | |
| images: | | |
| docker.io/awslabs/${{ inputs.image || 'core-mcp-server' }} | |
| # Disable all but the raw and sha | |
| tags: | | |
| type=schedule,enable=false | |
| type=semver,pattern={{raw}},enable=false | |
| type=pep440,pattern={{raw}},enable=false | |
| type=match,pattern=(.*),group=1,enable=false | |
| type=edge,enable=false | |
| type=ref,event=branch,enable=false | |
| type=ref,event=tag,enable=false | |
| type=ref,event=pr,enable=false | |
| type=sha,format=long,enable=true | |
| type=raw,value=latest,enable=true # {{is_default_branch}} doesn't work | |
| type=raw,value=${{ inputs.version || '0.0.0' }},enable=${{ inputs.version || 'false' }} | |
| # Override because it is a monorepo | |
| labels: | | |
| maintainer=AWSLabs MCP | |
| org.opencontainers.image.description=Test Description | |
| org.opencontainers.image.source=https://github.com/awslabs/mcp/tree/main/src/${{ inputs.image || 'core-mcp-server' }} | |
| org.opencontainers.image.title=awslabs.${{ inputs.image || 'core-mcp-server' }} | |
| org.opencontainers.image.url=https://github.com/awslabs/mcp/tree/main/src/${{ inputs.image || 'core-mcp-server' }} | |
| org.opencontainers.image.version=${{ inputs.version || '0.0.0' }} | |
| org.opencontainers.image.vendor=Amazon Web Service, Inc. | |
| - name: Create manifest list and push | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(printf 'awslabs/${{ inputs.image || 'core-mcp-server' }}@sha256:%s ' *) | |
| - name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect awslabs/${{ inputs.image || 'core-mcp-server' }}:${{ steps.meta.outputs.version }} |