From 3d3e9cb82e6664a4250782e6ae3a4e1112cfe5be Mon Sep 17 00:00:00 2001 From: Justin Law <81255462+justinthelaw@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:21:05 -0400 Subject: [PATCH] feat(task)!: add optional config input to create, deploy package and bundle tasks (#262) Co-authored-by: Wayne Starr --- tasks/create.yaml | 22 +++++++++++++++------- tasks/deploy.yaml | 14 +++++++++++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/tasks/create.yaml b/tasks/create.yaml index c25a4093..94828e3a 100644 --- a/tasks/create.yaml +++ b/tasks/create.yaml @@ -14,10 +14,16 @@ tasks: architecture: description: The architecture of the package to create default: ${UDS_ARCH} + config: + description: Optionally provide a path to a Zarf config file + default: "" + required: false actions: - - cmd: | - if [ "${FLAVOR}" != "registry1" ] || [ ${{ .inputs.architecture }} != "arm64" ]; then - ./uds zarf package create ${{ .inputs.path }} --confirm --no-progress --architecture="${{ .inputs.architecture }}" --flavor="${FLAVOR}" ${{ .inputs.options }} + - env: + - ZARF_CONFIG=${{ .inputs.config }} + cmd: | + if [ "${FLAVOR}" != "registry1" ] || [ "${{ .inputs.architecture }}" != "arm64" ]; then + ./uds zarf package create ${{ .inputs.path }} --confirm --no-progress --architecture="${{ .inputs.architecture }}" --flavor "${FLAVOR}" ${{ .inputs.options }} else echo "Registry1 packages cannot be made for 'arm64'" fi @@ -31,15 +37,17 @@ tasks: description: Path relative to the repositories root where the uds-bundle.yaml lives default: bundle config: - description: File name of the bundle config file. Defaults to uds-config.yaml. Path is relative to the path input. - default: uds-config.yaml + description: Path to the bundle config file. Defaults to bundle/uds-config.yaml. + default: bundle/uds-config.yaml architecture: description: The architecture of the bundle to create default: ${UDS_ARCH} actions: - - cmd: | + - env: + - UDS_CONFIG=${{ .inputs.config }} + cmd: | if [ "${FLAVOR}" != "registry1" ] || [ "${{ .inputs.architecture }}" != "arm64" ]; then - UDS_CONFIG=${{ .inputs.path }}/${{ .inputs.config }} ./uds create ${{ .inputs.path }} --confirm --no-progress --architecture="${{ .inputs.architecture }}" ${{ .inputs.options }} + ./uds create ${{ .inputs.path }} --confirm --no-progress --architecture="${{ .inputs.architecture }}" ${{ .inputs.options }} else echo "Registry1 bundles cannot be made for 'arm64'" fi diff --git a/tasks/deploy.yaml b/tasks/deploy.yaml index 4958d53f..dd7bc089 100644 --- a/tasks/deploy.yaml +++ b/tasks/deploy.yaml @@ -7,6 +7,10 @@ tasks: path: description: Path relative to the repositories root where the zarf.yaml and .tar.zst lives default: . + config: + description: Optionally provide a path to a Zarf config file + default: "" + required: false actions: - description: Get the current Zarf package name cmd: cat ${{ .inputs.path }}/zarf.yaml | ./uds zarf tools yq .metadata.name @@ -17,6 +21,8 @@ tasks: setVariables: - name: PACKAGE_VERSION - description: Deploy the UDS Zarf Package + env: + - ZARF_CONFIG=${{ .inputs.config }} cmd: ./uds zarf package deploy "${{ .inputs.path }}/zarf-package-${PACKAGE_NAME}-${UDS_ARCH}-${PACKAGE_VERSION}.tar.zst" --confirm --no-progress ${{ .inputs.options }} - name: test-bundle @@ -26,8 +32,8 @@ tasks: description: Path relative to the repositories root where the uds-bundle.yaml and .tar.zst lives default: bundle config: - description: File name of the bundle config file. Defaults to uds-config.yaml. Path is relative to the path input. - default: uds-config.yaml + description: Path to the bundle config file. Defaults to bundle/uds-config.yaml. + default: bundle/uds-config.yaml options: description: For setting deploy time variables and flags actions: @@ -40,4 +46,6 @@ tasks: setVariables: - name: BUNDLE_VERSION - description: Deploy the UDS bundle with the package and its dependencies - cmd: UDS_CONFIG=${{ .inputs.path }}/${{ .inputs.config }} ./uds deploy "${{ .inputs.path }}/uds-bundle-${BUNDLE_NAME}-${UDS_ARCH}-${BUNDLE_VERSION}.tar.zst" --confirm --no-progress ${{ .inputs.options }} + env: + - UDS_CONFIG=${{ .inputs.config }} + cmd: ./uds deploy "${{ .inputs.path }}/uds-bundle-${BUNDLE_NAME}-${UDS_ARCH}-${BUNDLE_VERSION}.tar.zst" --confirm --no-progress ${{ .inputs.options }}