From 1802f875ccd314cc6fa28f16b931fe7215c31af7 Mon Sep 17 00:00:00 2001 From: Cormac McCarthy Date: Tue, 3 Oct 2023 14:47:55 -0700 Subject: [PATCH] Resolve review feedback --- README.md | 2 +- action.yml | 49 ++++++++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9ec720b3..222df5f1 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ For more information on the structure of the YAML configuration file, please vis | `resourceGroup` | No | The existing resource group that the Azure Container App will be created in. If not provided, this value will be `-rg` and its existence will first be checked before attempting to create it. | | `containerAppEnvironment` | No | The name of the Container App environment to use with the application. If not provided, an existing environment in the resource group of the Container App will be used, otherwise, an environment will be created in the formation `-env`. | | `runtimeStack` | No | The platform version stack used in the final runnable application image that is deployed to the Container App. The value should be provided in the formation `:`. If not provided, this value is determined by Oryx based on the contents of the provided application. Please refer to [this document](https://github.com/microsoft/Oryx/blob/main/doc/supportedRuntimeVersions.md) for more information on supported runtime stacks for Oryx. | -| `builderVersion` | No | The version of the Oryx++ builder that should be used to build the provided application source and produce the runnable application image. You can provide a specific image tag, such as "debian-bookworm-20230928.2", or you can provide a supported OS version, such as "debian-bookworm" or "debian-bullseye", and the current supported image tag for the corresponding OS version will be used. If no version is provided, this action will attempt to build the provided application source with each supported OS version until a successful build is completed. | +| `builderStack` | No | The stack (OS) that should be used to build the provided application source and produce the runnable application image. You can provide a specific image tag for the stack, such as "debian-bookworm-20230928.2", or you can provide a supported stack name, such as "debian-bookworm" or "debian-bullseye", and the latest supported image tag for that stack will be used. If no stack is provided, this action will attempt to build the provided application source with each supported stack until there's a successful build. | | `targetPort` | No | The designated port for the application to run on. If no value is provided and the builder is used to build the runnable application image, the target port will be set to 80 for Python applications and 8080 for all other platform applications. If no value is provided when creating a Container App, the target port will default to 80. Note: when using this action to update a Container App, the target port may be updated if not provided based on changes to the ingress property. | | `location` | No | The location that the Container App (and other created resources) will be deployed to. To view locations suitable for creating the Container App in, please run the following: `az provider show -n Microsoft.App --query "resourceTypes[?resourceType=='containerApps'].locations"` | | `environmentVariables` | No | A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret. | diff --git a/action.yml b/action.yml index cdfaab4a..6de2bfcd 100644 --- a/action.yml +++ b/action.yml @@ -80,13 +80,13 @@ inputs: runtime stacks for Oryx: https://github.com/microsoft/Oryx/blob/main/doc/supportedRuntimeVersions.md' required: false - builderVersion: + builderStack: description: | - 'The version of the Oryx++ builder that should be used to build the provided application source and produce the - runnable application image. You can provide a specific image tag, such as "debian-bookworm-20230928.2", or you - can provide a supported OS version, such as "debian-bookworm" or "debian-bullseye", and the latest supported - image tag for the corresponding OS version will be used. If no version is provided, this action will attempt to - build the provided application source with each supported OS version until a successful build is completed.' + 'The stack (OS) that should be used to build the provided application source and produce the runnable application + image. You can provide a specific image tag for the stack, such as "debian-bookworm-20230928.2", or you can + provide a supported stack name, such as "debian-bookworm" or "debian-bullseye", and the latest supported image tag + for that stack will be used. If no stack is provided, this action will attempt to build the provided application + source with each supported stack until there's a successful build.' required: false targetPort: description: | @@ -422,11 +422,11 @@ runs: CA_GH_ACTION_TARGET_PORT="${{ inputs.targetPort }}" echo "CA_GH_ACTION_TARGET_PORT=${CA_GH_ACTION_TARGET_PORT}" >> $GITHUB_ENV - - name: Determine default target port if not provided and no Dockerfile provided/found + - name: Default to target port 80 if one wasn't provided and no Dockerfile provided/found with the application source if: ${{ env.CA_GH_ACTION_INGRESS_ENABLED == 'true' && inputs.targetPort == '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && inputs.appSourcePath != '' && env.CA_GH_ACTION_YAML_PROVIDED != 'true' }} shell: bash run: | - CA_GH_ACTION_TARGET_PORT="8080" + CA_GH_ACTION_TARGET_PORT="80" echo "CA_GH_ACTION_TARGET_PORT=${CA_GH_ACTION_TARGET_PORT}" >> $GITHUB_ENV - name: Default to target port 80 if one wasn't provided or found, and ingress is enabled, and the Container App doesn't exist (prevent overriding) @@ -474,7 +474,7 @@ runs: - name: Set Oryx++ Builder as default builder if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' }} shell: bash - run: pack config default-builder mcr.microsoft.com/oryx/builder:debian-bookworm-20230928.2 + run: pack config default-builder mcr.microsoft.com/oryx/builder:debian-bullseye-20230928.2 - name: Enable experimental features for Oryx++ Builder if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' }} @@ -506,27 +506,22 @@ runs: echo "CA_GH_ACTION_RUNTIME_STACK_PLATFORM=${CA_GH_ACTION_RUNTIME_STACK_PLATFORM}" >> $GITHUB_ENV echo "CA_GH_ACTION_RUNTIME_STACK_VERSION=${CA_GH_ACTION_RUNTIME_STACK_VERSION}" >> $GITHUB_ENV - - name: Set environment variables for builder invocation + - name: Set platform environment variables for builder invocation if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && inputs.runtimeStack != '' }} shell: bash run: | CA_GH_ACTION_ORYX_BUILDER_ENV_ARG="--env ORYX_PLATFORM_NAME=${{ env.CA_GH_ACTION_RUNTIME_STACK_PLATFORM }} --env ORYX_PLATFORM_VERSION=${{ env.CA_GH_ACTION_RUNTIME_STACK_VERSION }}" echo "CA_GH_ACTION_ORYX_BUILDER_ENV_ARG=${CA_GH_ACTION_ORYX_BUILDER_ENV_ARG}" >> $GITHUB_ENV - - name: Create runnable application image using bookworm Oryx++ Builder - if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && (inputs.builderVersion == '' || inputs.builderVersion == 'debian-bookworm') }} + - name: Set port environment variable for builder invocation + if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && env.CA_GH_ACTION_TARGET_PORT != '' }} shell: bash run: | - pack build \ - ${{ env.CA_GH_ACTION_IMAGE_TO_DEPLOY }} \ - --path ${{ inputs.appSourcePath }} \ - --builder mcr.microsoft.com/oryx/builder:debian-bookworm-20230928.2 \ - ${{ env.CA_GH_ACTION_ORYX_BUILDER_ENV_ARG }} \ - ${{ env.CA_GH_ACTION_ORYX_BUILDER_TELEMETRY_ARG }} || \ - echo "CA_GH_ACTION_USE_BULLSEYE_BUILDER=true" >> $GITHUB_ENV + CA_GH_ACTION_ORYX_BUILDER_ENV_ARG="${CA_GH_ACTION_ORYX_BUILDER_ENV_ARG} --env ORYX_RUNTIME_PORT=${{ env.CA_GH_ACTION_TARGET_PORT }}" + echo "CA_GH_ACTION_ORYX_BUILDER_ENV_ARG=${CA_GH_ACTION_ORYX_BUILDER_ENV_ARG}" >> $GITHUB_ENV - name: Create runnable application image using bullseye Oryx++ Builder - if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && ((inputs.builderVersion == '' && env.CA_GH_ACTION_USE_BULLSEYE_BUILDER == 'true') || inputs.builderVersion == 'debian-bullseye') }} + if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && (inputs.builderStack == '' || inputs.builderStack == 'debian-bullseye') }} shell: bash run: | pack build \ @@ -535,27 +530,27 @@ runs: --builder mcr.microsoft.com/oryx/builder:debian-bullseye-20230928.2 \ ${{ env.CA_GH_ACTION_ORYX_BUILDER_ENV_ARG }} \ ${{ env.CA_GH_ACTION_ORYX_BUILDER_TELEMETRY_ARG }} || \ - echo "CA_GH_ACTION_USE_BUSTER_BUILDER=true" >> $GITHUB_ENV + echo "CA_GH_ACTION_USE_BOOKWORM_BUILDER=true" >> $GITHUB_ENV - - name: Create runnable application image using buster Oryx++ Builder - if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && ((inputs.builderVersion == '' && env.CA_GH_ACTION_USE_BUSTER_BUILDER == 'true') || inputs.builderVersion == 'debian-buster') }} + - name: Create runnable application image using bookworm Oryx++ Builder + if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && ((inputs.builderStack == '' && env.CA_GH_ACTION_USE_BOOKWORM_BUILDER == 'true') || inputs.builderStack == 'debian-bookworm') }} shell: bash run: | pack build \ ${{ env.CA_GH_ACTION_IMAGE_TO_DEPLOY }} \ --path ${{ inputs.appSourcePath }} \ - --builder mcr.microsoft.com/oryx/builder:debian-buster-20230928.2 \ + --builder mcr.microsoft.com/oryx/builder:debian-bookworm-20230928.2 \ ${{ env.CA_GH_ACTION_ORYX_BUILDER_ENV_ARG }} \ ${{ env.CA_GH_ACTION_ORYX_BUILDER_TELEMETRY_ARG }} - name: Create runnable application image using builder version specified by input - if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && inputs.builderVersion != '' && inputs.builderVersion != 'debian-bookworm' && inputs.builderVersion != 'debian-bullseye' && inputs.builderVersion != 'debian-buster' }} + if: ${{ inputs.appSourcePath != '' && env.CA_GH_ACTION_DOCKERFILE_PATH == '' && inputs.builderStack != '' && inputs.builderStack != 'debian-bookworm' && inputs.builderStack != 'debian-bullseye' }} shell: bash run: | pack build \ ${{ env.CA_GH_ACTION_IMAGE_TO_DEPLOY }} \ --path ${{ inputs.appSourcePath }} \ - --builder mcr.microsoft.com/oryx/builder:${{ inputs.builderVersion }} \ + --builder mcr.microsoft.com/oryx/builder:${{ inputs.builderStack }} \ ${{ env.CA_GH_ACTION_ORYX_BUILDER_ENV_ARG }} \ ${{ env.CA_GH_ACTION_ORYX_BUILDER_TELEMETRY_ARG }} @@ -711,6 +706,6 @@ runs: run: | docker run \ --rm \ - mcr.microsoft.com/oryx/cli:builder-debian-bookworm-20230926.1 \ + mcr.microsoft.com/oryx/cli:builder-debian-bullseye-20230926.1 \ /bin/bash \ -c "oryx telemetry --event-name 'ContainerAppsGitHubAction' ${{ env.CA_GH_ACTION_LENGTH_MILLISECONDS_ARG }} ${{ env.CA_GH_ACTION_SCENARIO_ARG }} ${{ env.CA_GH_ACTION_RESULT_ARG }}"