removal on schema definition #117
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
| name: Collect source for GPL/MPL licensed code | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Image tag to filter ECR images" | ||
| required: true | ||
| archive-name: | ||
| description: "File name to store the archived source code" | ||
| required: true | ||
| output-dir: | ||
| description: "Path to store temporarily the downloaded source code" | ||
| required: false | ||
| default: "output" | ||
| jobs: | ||
| collect-images-list: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| images: ${{ steps.ecr-images.outputs.images }} | ||
| steps: | ||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_ROLE }} | ||
| role-session-name: Github | ||
| aws-region: ${{ secrets.AWS_REGION }} | ||
| - name: Login to Amazon ECR | ||
| id: login-ecr | ||
| uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1 | ||
| - name: Get ECR images with specified tag | ||
| id: ecr-images | ||
| env: | ||
| TAG: ${{ github.event.inputs.tag }} | ||
| run: | | ||
| # Get the list of repositories that start with the geti/ prefix | ||
| REPOS=$(aws ecr describe-repositories --query "repositories[].repositoryName" --output text | tr '\t' '\n' | grep '^geti/' | grep -v '^geti/helm/') | ||
| cat /dev/null > ecr_images.txt | ||
| for REPO in $REPOS; do | ||
| echo "Processing repository: $REPO" | ||
| aws ecr describe-images --repository-name $REPO --image-ids imageTag=$TAG > /dev/null 2>&1 | ||
| exit_code="$?" | ||
| if [ "$exit_code" -eq 0 ]; then | ||
| IMAGE_URI="${{ secrets.REGISTRY }}/${REPO}:${TAG}" | ||
| echo "Found image: $IMAGE_URI" | ||
| echo "$IMAGE_URI" >> ecr_images.txt | ||
| else | ||
| echo "No image with tag '${TAG}' found in repository '${REPO}'" | ||
| fi | ||
| done | ||
| echo "ECR images with tag '${TAG}':" | ||
| cat ecr_images.txt | ||
| IMAGES=$(cat ecr_images.txt | tr '\n' ',' | sed 's/,$//') | ||
| echo "images=$IMAGES" >> $GITHUB_OUTPUT | ||
| collect-source: | ||
| runs-on: ubuntu-latest | ||
| needs: collect-images-list | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Collect source code | ||
| uses: open-edge-platform/geti-ci/actions/collect_source@a99c99d09285f5920855ee773031e487ad34fa57 | ||
| with: | ||
| images: ${{ needs.collect-images-list.outputs.images }} | ||
| archive-name: ${{ github.event.inputs.archive-name }} | ||
| output-dir: ${{ github.event.inputs.output-dir }} | ||
| secrets: | ||
| AWS_ROLE: ${{ secrets.AWS_ROLE }} | ||
| AWS_REGION: ${{ secrets.AWS_REGION }} | ||
| REGISTRY: ${{ secrets.REGISTRY }} | ||