mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-25 23:49:37 -05:00
9d58f8a494
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
83 lines
2.7 KiB
YAML
83 lines
2.7 KiB
YAML
name: Select image
|
|
description: Resolve string presets and shortpaths to shortpaths only
|
|
|
|
inputs:
|
|
osImage:
|
|
description: "Shortpath, main-debug, main-nightly, or release-stable"
|
|
required: true
|
|
|
|
outputs:
|
|
osImage:
|
|
description: "Shortpath of input string, original input if that was already a shortpath"
|
|
value: ${{ steps.set-output.outputs.osImage }}
|
|
isDebugImage:
|
|
description: "Input is a debug image or not"
|
|
value: ${{ steps.set-output.outputs.isDebugImage }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Login to AWS
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
|
with:
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
|
|
aws-region: eu-central-1
|
|
|
|
- name: Input is preset
|
|
id: input-is-preset
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ inputs.osImage }}" == "ref/main/stream/debug/?" || "${{ inputs.osImage }}" == "ref/main/stream/nightly/?" || "${{ inputs.osImage }}" == "ref/release/stream/stable/?" ]]; then
|
|
echo "result=true" | tee -a "$GITHUB_OUTPUT"
|
|
else
|
|
echo "result=false" | tee -a "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Separate ref and stream from matrix
|
|
if: steps.input-is-preset.outputs.result == 'true'
|
|
id: separate-ref-stream
|
|
env:
|
|
REFSTREAM: ${{ inputs.osImage }}
|
|
shell: bash
|
|
run: |
|
|
echo "ref=$(echo $REFSTREAM | cut -d/ -f2)" | tee -a "$GITHUB_OUTPUT"
|
|
echo "stream=$(echo $REFSTREAM | cut -d/ -f4)" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup Bazel & Nix
|
|
if: steps.input-is-preset.outputs.result == 'true'
|
|
uses: ./.github/actions/setup_bazel_nix
|
|
|
|
- name: Find latest image
|
|
if: steps.input-is-preset.outputs.result == 'true'
|
|
id: find-latest-image
|
|
uses: ./.github/actions/versionsapi
|
|
with:
|
|
command: latest
|
|
ref: ${{ steps.separate-ref-stream.outputs.ref == 'release' && '-' || steps.separate-ref-stream.outputs.ref }}
|
|
stream: ${{ steps.separate-ref-stream.outputs.stream }}
|
|
|
|
- name: Set outputs
|
|
id: set-output
|
|
shell: bash
|
|
run: |
|
|
if [[ ${{ steps.input-is-preset.outputs.result }} == "true" ]]
|
|
then
|
|
export IMAGE=${{ steps.find-latest-image.outputs.output }}
|
|
else
|
|
export IMAGE=${{ inputs.osImage }}
|
|
fi
|
|
|
|
echo "osImage=$IMAGE" | tee -a "$GITHUB_OUTPUT"
|
|
echo "Using image: $IMAGE"
|
|
|
|
case "$IMAGE" in
|
|
*"/stream/debug/"*)
|
|
echo "isDebugImage=true" | tee -a "$GITHUB_OUTPUT"
|
|
echo "Image is debug image."
|
|
;;
|
|
*)
|
|
echo "isDebugImage=false" | tee -a "$GITHUB_OUTPUT"
|
|
echo "Image is not debug image."
|
|
;;
|
|
esac
|