-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
185 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: CI Deploy | ||
description: Deploys the published images to the remote cluster | ||
inputs: | ||
discover_output: | ||
description: The output from the discover step | ||
required: true | ||
tag: | ||
description: The image tag to deploy | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Discover | ||
shell: bash | ||
id: discover | ||
run: | | ||
PAYLOAD=$(echo '${{ inputs.discover_output }}' | jq -cr 'map({(.images | split(" ")[] ): "${{ inputs.tag }}"}) | add') | ||
echo "Payload: ${PAYLOAD}" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI Discovery | ||
description: Discovers Earthfiles in the given paths and compiles data about them | ||
inputs: | ||
parse_images: | ||
description: Whether the image names from the given targets should be returnd (requires at least one target) | ||
required: false | ||
default: "false" | ||
paths: | ||
description: A space separated list of paths to search | ||
required: false | ||
default: "." | ||
targets: | ||
description: A space seperated list of targets to filter against | ||
required: false | ||
default: "" | ||
outputs: | ||
json: | ||
description: "JSON object containing information about discovered Earthfiles" | ||
value: ${{ steps.discover.outputs.json }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Discover | ||
shell: bash | ||
id: discover | ||
run: | | ||
FLAGS=("-j") | ||
if [[ "${{ inputs.parse_images }}" == "true" ]]; then | ||
FLAGS+=("-i") | ||
fi | ||
for target in ${{ inputs.targets }}; do | ||
FLAGS+=("-t" "$target") | ||
done | ||
JSON_OUTPUT=$(ci scan "${FLAGS[@]}" ${{ inputs.paths }}) | ||
if [[ "${{ inputs.parse_images }}" == "true" ]]; then | ||
OUTPUT=$(echo "$JSON_OUTPUT" | jq -cr '[.[] | .images |= join(" ")]') | ||
else | ||
OUTPUT="${JSON_OUTPUT}" | ||
fi | ||
echo "json=$OUTPUT" >>$GITHUB_OUTPUT |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: CI Publish | ||
description: Publishes the given Docker containers | ||
inputs: | ||
earthfile: | ||
description: Path to the Earthfile (excluding /Earthfile suffix) to build | ||
required: true | ||
earthly_satellite: | ||
description: The address of the remote Earthly satellite to use | ||
required: true | ||
images: | ||
description: A space seperated list of images the Earthfile will produce | ||
required: true | ||
registry: | ||
description: The registry to publish containers images to | ||
required: true | ||
tags: | ||
description: A space seperated list of tags to tag the resulting images with | ||
target: | ||
description: The target to build for the given Earthfile | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build | ||
shell: bash | ||
run: | | ||
earthly \ | ||
--buildkit-host "tcp://${{ inputs.earthly_satellite }}:8372" \ | ||
${{ inputs.earthfile }}+${{ inputs.target }} \ | ||
--tag=latest | ||
for image in ${{ inputs.images }}; do | ||
for tag in ${{ inputs.tags }}; do | ||
echo "Tagging ${image}:latest as ${{ inputs.registry }}/${image}:${tag}" | ||
docker tag "${image}:latest" "${{ inputs.registry }}/${image}:${tag}" | ||
echo "Pushing ${{ inputs.registry }}/${image}:${tag}" | ||
docker push "${{ inputs.registry }}/${image}:${tag}" | ||
done | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI Setup | ||
description: Performs required steps to setup CI | ||
inputs: | ||
aws_role_arn: | ||
description: The ARN of the CI role (used for fetching secrets) | ||
required: true | ||
aws_region: | ||
description: The AWS region to use | ||
required: true | ||
cli_version: | ||
description: The version of the CI CLI to install | ||
required: false | ||
default: 0.0.1 | ||
earthly_version: | ||
description: The version of Earthly to install | ||
required: false | ||
default: latest | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Earthly | ||
uses: earthly/actions-setup@v1 | ||
with: | ||
version: ${{ inputs.earthly_version }} | ||
- name: Install CLI | ||
shell: bash | ||
run: | | ||
sudo curl \ | ||
-L https://github.com/input-output-hk/catalyst-ci/releases/download/v${{ inputs.cli_version }}/ci-linux-amd64 \ | ||
-o /usr/bin/ci | ||
sudo chmod +x /usr/bin/ci | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: ${{ inputs.aws_role_arn }} | ||
aws-region: ${{ inputs.aws_region }} | ||
- name: Setup Earthly Satellite | ||
shell: bash | ||
run: mkdir -p /tmp/certs && ci setup /tmp/certs |