2023-01-02 07:34:49 -05:00
|
|
|
name: Versionsapi cli
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
command:
|
|
|
|
description: Command to run
|
|
|
|
required: true
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- latest
|
|
|
|
- list
|
2023-01-12 07:17:23 -05:00
|
|
|
- add
|
2023-01-09 10:29:30 -05:00
|
|
|
- remove
|
2023-01-02 07:34:49 -05:00
|
|
|
ref:
|
|
|
|
description: --ref flag
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
stream:
|
|
|
|
description: --stream flag
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
version:
|
|
|
|
description: --version flag
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-03-10 04:21:58 -05:00
|
|
|
kind:
|
|
|
|
description: --kind flag
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-01-16 04:08:45 -05:00
|
|
|
version_path:
|
|
|
|
description: --version-path flag
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-01-02 07:34:49 -05:00
|
|
|
add_latest:
|
|
|
|
description: --latest flag
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
type: boolean
|
|
|
|
add_release:
|
|
|
|
description: --release flag
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
type: boolean
|
|
|
|
rm_all:
|
|
|
|
description: --all flag
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
type: boolean
|
2023-01-03 10:03:08 -05:00
|
|
|
dryrun:
|
|
|
|
description: --dryrun flag
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
type: boolean
|
2023-01-02 07:34:49 -05:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
command:
|
|
|
|
description: Command to run
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
ref:
|
|
|
|
description: --ref flag
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
stream:
|
|
|
|
description: --stream flag
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
version:
|
|
|
|
description: --version flag
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-03-10 04:21:58 -05:00
|
|
|
kind:
|
|
|
|
description: --kind flag
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-01-16 04:08:45 -05:00
|
|
|
version_path:
|
|
|
|
description: --version-path flag
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-01-02 07:34:49 -05:00
|
|
|
add_latest:
|
|
|
|
description: --latest flag
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
add_release:
|
|
|
|
description: --release flag
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
rm_all:
|
|
|
|
description: --all flag
|
|
|
|
required: false
|
|
|
|
type: boolean
|
2023-01-03 10:03:08 -05:00
|
|
|
dryrun:
|
|
|
|
description: --dryrun flag
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
type: boolean
|
2023-01-02 07:34:49 -05:00
|
|
|
outputs:
|
|
|
|
output:
|
|
|
|
description: Output of the command
|
|
|
|
value: ${{ jobs.versionsapi.outputs.output }}
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: versionsapi
|
|
|
|
cancel-in-progress: false
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
versionsapi:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
outputs:
|
|
|
|
output: ${{ steps.run.outputs.output }}
|
|
|
|
steps:
|
2023-01-12 07:17:23 -05:00
|
|
|
- name: Check out repository
|
|
|
|
id: checkout
|
2023-12-20 10:10:35 -05:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2023-01-02 07:34:49 -05:00
|
|
|
with:
|
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
|
|
|
|
|
|
|
- name: Check required rights
|
|
|
|
id: check-rights
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
case "${{ inputs.command }}" in
|
|
|
|
add)
|
|
|
|
echo "Write access to S3 bucket required."
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "write=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-02 07:34:49 -05:00
|
|
|
echo "No authentication at cloud provider required."
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "auth=false" | tee -a "$GITHUB_OUTPUT"
|
2023-01-02 07:34:49 -05:00
|
|
|
;;
|
2023-01-09 10:29:30 -05:00
|
|
|
remove)
|
2023-01-02 07:34:49 -05:00
|
|
|
echo "Write access to S3 bucket required."
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "write=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-02 07:34:49 -05:00
|
|
|
echo "Authentication at cloud provider required."
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "auth=true" | tee -a "$GITHUB_OUTPUT"
|
2023-01-02 07:34:49 -05:00
|
|
|
;;
|
|
|
|
latest | list)
|
|
|
|
echo "Only read access required."
|
2023-04-14 12:25:53 -04:00
|
|
|
echo "write=false" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
echo "auth=false" | tee -a "$GITHUB_OUTPUT"
|
2023-01-02 07:34:49 -05:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown command '${{ inputs.command }}'."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
- name: Login to AWS without write access
|
|
|
|
if: steps.check-rights.outputs.write == 'false'
|
2024-02-21 09:29:06 -05:00
|
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
2023-01-02 07:34:49 -05:00
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
|
|
|
|
aws-region: eu-central-1
|
|
|
|
|
|
|
|
- name: Login to AWS with write access
|
|
|
|
if: steps.check-rights.outputs.write == 'true' && steps.check-rights.outputs.auth == 'false'
|
2024-02-21 09:29:06 -05:00
|
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
2023-01-02 07:34:49 -05:00
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIWrite
|
|
|
|
aws-region: eu-central-1
|
|
|
|
|
|
|
|
- name: Login to AWS with write and image remove access
|
|
|
|
if: steps.check-rights.outputs.write == 'true' && steps.check-rights.outputs.auth == 'true'
|
2024-02-21 09:29:06 -05:00
|
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
2023-01-02 07:34:49 -05:00
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRemove
|
|
|
|
aws-region: eu-central-1
|
|
|
|
|
|
|
|
- name: Login to Azure
|
|
|
|
if: steps.check-rights.outputs.auth == 'true'
|
|
|
|
uses: ./.github/actions/login_azure
|
|
|
|
with:
|
|
|
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Login to GCP
|
|
|
|
if: steps.check-rights.outputs.auth == 'true'
|
|
|
|
uses: ./.github/actions/login_gcp
|
|
|
|
with:
|
2023-11-27 07:04:41 -05:00
|
|
|
service_account: "image-deleter@constellation-images.iam.gserviceaccount.com"
|
2023-01-02 07:34:49 -05:00
|
|
|
|
|
|
|
- name: Execute versionsapi CLI
|
|
|
|
id: run
|
2023-01-12 07:17:23 -05:00
|
|
|
uses: ./.github/actions/versionsapi
|
|
|
|
with:
|
|
|
|
command: ${{ inputs.command }}
|
|
|
|
ref: ${{ inputs.ref }}
|
|
|
|
stream: ${{ inputs.stream }}
|
|
|
|
version: ${{ inputs.version }}
|
2023-03-10 04:21:58 -05:00
|
|
|
kind: ${{ inputs.kind }}
|
2023-01-16 04:08:45 -05:00
|
|
|
version_path: ${{ inputs.version_path }}
|
2023-01-12 07:17:23 -05:00
|
|
|
add_latest: ${{ inputs.add_latest }}
|
|
|
|
add_release: ${{ inputs.add_release }}
|
|
|
|
rm_all: ${{ inputs.rm_all }}
|
|
|
|
dryrun: ${{ inputs.dryrun }}
|