Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Commit

Permalink
WIP deploy tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
justinthelaw committed Oct 3, 2024
1 parent 8e4c033 commit c9505a9
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 16 deletions.
1 change: 1 addition & 0 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ includes:
- publish: ./tasks/publish.yaml
- setup: ./tasks/setup.yaml
- deploy: ./tasks/deploy.yaml
- utils: ./tasks/utils.yaml

tasks:
#######
Expand Down
38 changes: 28 additions & 10 deletions tasks/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ tasks:
cmd: |
if [[ ${FLAVOR} != "upstream" || ${{ .inputs.override }} != "false" ]]; then
if [ ! "$(docker ps -q -f name=${{ .inputs.name }})" ]; then
docker run -d -p ${{ .inputs.port }}:5000 --restart=always --name ${{ .inputs.name }} registry:2 -q
fi
docker run -d -p ${{ .inputs.port }}:5000 --restart=always -q --name ${{ .inputs.name }} registry:2
echo "false"
else
echo "Non-upstream flavor detected, skipping local registry build"
echo "true"
fi
mute: true
setVariables:
- name: ENABLE_LOG
- task: utils:log
with:
log: "Non-upstream flavor detected, skipping local image build"
enable: ${ENABLE_LOG}

###########
# REUSEABLE
Expand Down Expand Up @@ -72,8 +79,9 @@ tasks:
description: "Image repository for the image tag"
required: true
actions:
- cmd: |
printf "\n🐸 Creating image at ${{ .inputs.dockerfile }}\n\n"
- task: utils:log
with:
log: "Creating image at ${{ .inputs.dockerfile }}"
- description: "Build the Docker image"
shell:
linux: bash
Expand All @@ -86,9 +94,17 @@ tasks:
-f ${{ .inputs.dockerfile }} \
--build-arg LOCAL_VERSION=${{ .inputs.version }} \
${{ .inputs.buildOptions }} ${{ .inputs.buildContext }}
echo "false"
else
echo "Non-upstream flavor detected, skipping image build"
echo "true"
fi
mute: true
setVariables:
- name: ENABLE_LOG
- task: utils:log
with:
log: "Non-upstream flavor detected, skipping local image build"
enable: ${ENABLE_LOG}

- name: package
description: "Create a Zarf package"
Expand Down Expand Up @@ -122,8 +138,9 @@ tasks:
description: "Set the version of the Zarf package and target image(s)"
required: true
actions:
- cmd: |
printf "\n🐸 Creating package at ${{ .inputs.path }}\n\n"
- task: utils:log
with:
log: "Creating package at ${{ .inputs.path }}"
- description: "Create the Zarf package"
task: create-common:package
env:
Expand Down Expand Up @@ -155,8 +172,9 @@ tasks:
default: ""
required: false
actions:
- cmd: |
printf "\n🐸 Creating bundle at ${{ .inputs.path }}\n\n"
- task: utils:log
with:
log: "Creating bundle at ${{ .inputs.path }}"
- description: "Create the UDS bundle"
task: create-common:test-bundle
with:
Expand Down
10 changes: 6 additions & 4 deletions tasks/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ tasks:
default: "--log-level warn --no-progress --confirm"
required: false
actions:
- cmd: |
printf "\n🐸 Deploying package at ${{ .inputs.path }}\n\n"
- task: utils:log
with:
log: "Deploying package at ${{ .inputs.path }}"
- description: Get the current Zarf package name
cmd: cat ${{ .inputs.path }}/zarf.yaml | uds zarf tools yq .metadata.name
setVariables:
Expand Down Expand Up @@ -58,8 +59,9 @@ tasks:
description: "Set the version of the UDS Bundle and target image(s)"
required: true
actions:
- cmd: |
printf "\n🐸 Deploying package at ${{ .inputs.path }}\n\n"
- task: utils:log
with:
log: "Deploying bundle at ${{ .inputs.path }}"
- task: deploy-common:test-bundle
env:
- UDS_ARCH=${{ .inputs.architecture }}
Expand Down
20 changes: 18 additions & 2 deletions tasks/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ tasks:
cmd: |
if [[ ${FLAVOR} = "upstream" || ${{ .inputs.override }} = "true" ]]; then
docker tag ${{ .inputs.current }} ${{ .inputs.new }}
echo "false"
else
echo "Non-upstream flavor detected, skipping image build"
echo "true"
fi
mute: true
setVariables:
- name: ENABLE_LOG
- task: utils:log
with:
log: "Non-upstream flavor detected, skipping local image re-tag"
enable: ${ENABLE_LOG}

- name: docker
description: "Push an existing Docker image to its tagged repository"
Expand All @@ -53,6 +61,14 @@ tasks:
cmd: |
if [[ ${FLAVOR} = "upstream" || ${{ .inputs.override }} = "true" ]]; then
docker push ${{ .inputs.tag }} ${{ .inputs.options }}
echo "false"
else
echo "Non-upstream flavor detected, skipping image build"
echo "true"
fi
mute: true
setVariables:
- name: ENABLE_LOG
- task: utils:log
with:
log: "Non-upstream flavor detected, skipping local image push"
enable: ${ENABLE_LOG}
12 changes: 12 additions & 0 deletions tasks/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ tasks:
- name: k3d-cpu-cluster-slim
description: "Creates a UDS K3d cluster with slim UDS Core and CPU-only Capability"
actions:
- task: utils:log
with:
log: "Creating a UDS K3d cluster with slim UDS Core and CPU-only Capability"
- task: setup-common:k3d-test-cluster

- name: k3d-gpu-cluster-slim
description: "Creates a UDS K3d cluster with slim UDS Core and NVIDIA GPU Capability"
actions:
- task: utils:log
with:
log: "Creating a UDS K3d cluster with slim UDS Core and NVIDIA GPU Capability"
- task: create:k3d-gpu-image
- task: setup-common:k3d-test-cluster
with:
Expand All @@ -35,6 +41,9 @@ tasks:
- name: k3d-cpu-cluster-full
description: "Creates a UDS K3d cluster with full UDS Core and CPU-only Capability"
actions:
- task: utils:log
with:
log: "Creating a UDS K3d cluster with full UDS Core and CPU-only Capability"
- task: setup-common:k3d-full-cluster
with:
version: 0.27.3
Expand All @@ -44,6 +53,9 @@ tasks:
- name: k3d-gpu-cluster-full
description: "Creates a UDS K3d cluster with full UDS Core and NVIDIA GPU Capability"
actions:
- task: utils:log
with:
log: "Creating a UDS K3d cluster with full UDS Core and NVIDIA GPU Capability"
- task: create:k3d-gpu-image
- task: setup-common:k3d-full-cluster
with:
Expand Down
19 changes: 19 additions & 0 deletions tasks/utils.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/uds-cli/v0.14.0/tasks.schema.json

tasks:
- name: log
description: "LeapfrogAI logger"
inputs:
log:
description: "Content to be logged to the CLI"
required: true
enable:
description: "Whether to enable or disable the logging"
default: "true"
required: false
actions:
- cmd: |
if [[ ${{ .inputs.enable }} = "true" ]]
printf "\n🐸 ${{ .inputs.log }}\n\n"
fi
mute: true

0 comments on commit c9505a9

Please sign in to comment.