Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v2-main branch into main #87

Merged
merged 41 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1c6a07a
Convert composite action to typescript (#61)
snehapar9 Oct 17, 2023
43f6f95
Migrate latest changes from v1 to v2 (#68)
cormacpayne Nov 7, 2023
4e84426
Support private registry scenario (#69)
snehapar9 Nov 7, 2023
0742a90
Remove env as a required arg (#72)
snehapar9 Nov 7, 2023
f41e2a3
Update targeted builders to 20231107.2
daniv-msft Nov 9, 2023
ce214ee
Merge pull request #74 from Azure/daniv/updateBuilderV2Main
daniv-msft Nov 9, 2023
be9f91d
Build and push non cloud scenarios from GHA (#75)
snehapar9 Nov 9, 2023
3018452
Remove location (#76)
snehapar9 Nov 14, 2023
87dd4bd
support build environment variable
yilims Nov 27, 2023
6cecedf
fix comiple error
yilims Nov 27, 2023
a121c4b
build ts file
yilims Nov 27, 2023
bf574f5
package ts file
yilims Nov 28, 2023
8b86f81
Revert "fix comiple error"
yilims Nov 28, 2023
30758b8
fix validation error
yilims Nov 28, 2023
d57e486
Update Container App with 'containerapp update'
harryli0108 Nov 28, 2023
cca00cd
support quotation mark
yilims Nov 29, 2023
0eec8e1
fix validation
yilims Nov 29, 2023
331b305
add log
yilims Nov 29, 2023
7a61322
build typescript to js
yilims Nov 29, 2023
fb3f02c
Revert "fix comiple error"
yilims Nov 29, 2023
7632b20
package ts to js
yilims Nov 29, 2023
ae8e58a
define constant for regex
yilims Nov 30, 2023
8a1e1e6
build ts to js
yilims Nov 30, 2023
c9cf98d
Update Container App and Ingress separately
harryli0108 Nov 30, 2023
045cbde
Addressed comment and kept support for admin cred
harryli0108 Dec 4, 2023
e5ee242
Fixed typo in validation
harryli0108 Dec 4, 2023
f58ba9f
support docker file build for buildArguments
yilims Dec 7, 2023
ee82df0
Update Azure login secrets for OIDC testing
harryli0108 Dec 12, 2023
277c13a
refine readme format
yilims Dec 13, 2023
ba9fb19
add validation for build environment variable
yilims Dec 13, 2023
f05367d
refine env name validation logic
yilims Dec 13, 2023
f297a65
Fixed typo and updated timeout on validation task
harryli0108 Dec 13, 2023
ea3922b
Fixed mismatch resource group name in validation
harryli0108 Dec 13, 2023
d1658e9
Merge pull request #81 from Azure/harrli/v2-up-cmd-reg-crd-fix
harryli0108 Dec 13, 2023
8d42afa
Merge branch 'v2-main' into v2-main
yilims Dec 14, 2023
469322a
regenerate index.js
yilims Dec 14, 2023
8c4a982
fix merge mistake
yilims Dec 14, 2023
2db597d
add examples for arg buildArguments
yilims Dec 18, 2023
b810aa7
add usage for buildArguments
yilims Dec 18, 2023
05c7e86
not validate build argument name when there's Dockerfile in root path
yilims Dec 18, 2023
3b7c9ee
Merge pull request #82 from yilims/v2-main
daniv-msft Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
679 changes: 679 additions & 0 deletions .github/workflows/run-validation-oidc.yml

Large diffs are not rendered by default.

89 changes: 88 additions & 1 deletion .github/workflows/run-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:

jobs:
create-using-builder:

name: 'Create app using builder'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -64,7 +65,48 @@ jobs:
shell: bash
run: az acr repository delete -n ${{ vars.TEST_ACR_NAME }} -t ${{ env.TEST_IMAGE_REPOSITORY }}:${{ env.TEST_IMAGE_TAG }} -y


create-using-builder-and-internal-registry:

name: 'Create app using builder and push to internal registry'
runs-on: ubuntu-latest
timeout-minutes: 10

env:
TEST_IMAGE_TAG: 'bs-${{ github.run_id }}'
TEST_CONTAINER_APP_NAME: 'gh-ca-bs-${{ github.run_id }}'

steps:
- name: Checkout action repository
uses: actions/checkout@v3

- name: Clone Oryx repository
uses: actions/checkout@v3
with:
repository: microsoft/Oryx
path: oryx

- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.TEST_AZURE_CREDENTIALS }}

- name: Execute Azure Container Apps Build and Deploy Action
uses: ./
with:
appSourcePath: '${{ github.workspace }}/oryx/tests/SampleApps/DotNetCore/NetCore6PreviewWebApp'
containerAppName: ${{ env.TEST_CONTAINER_APP_NAME }}
resourceGroup: ${{ vars.TEST_RESOURCE_GROUP_NO_ACR_NAME }}
disableTelemetry: ${{ vars.TEST_DISABLE_TELEMETRY }}

- name: Delete created Azure Container App
if: ${{ always() }}
shell: bash
run: az containerapp delete -n ${{ env.TEST_CONTAINER_APP_NAME }} -g ${{ vars.TEST_RESOURCE_GROUP_NO_ACR_NAME }} -y


create-using-found-dockerfile:

name: 'Create app using found Dockerfile'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -112,6 +154,7 @@ jobs:
run: az acr repository delete -n ${{ vars.TEST_ACR_NAME }} -t ${{ env.TEST_IMAGE_REPOSITORY }}:${{ env.TEST_IMAGE_TAG }} -y

create-using-provided-dockerfile:

name: 'Create app using provided Dockerfile'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -159,6 +202,7 @@ jobs:
shell: bash
run: az acr repository delete -n ${{ vars.TEST_ACR_NAME }} -t ${{ env.TEST_IMAGE_REPOSITORY }}:${{ env.TEST_IMAGE_TAG }} -y


create-using-image-linux:

name: 'Create app using image on Linux runner'
Expand Down Expand Up @@ -227,7 +271,7 @@ jobs:

name: 'Create app using image with new environment'
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 25

env:
TEST_CONTAINER_APP_NAME: 'gh-ca-is-ne-${{ github.run_id }}'
Expand Down Expand Up @@ -280,7 +324,9 @@ jobs:
shell: bash
run: az monitor log-analytics workspace delete -g ${{ vars.TEST_RESOURCE_GROUP_NAME }} -n ${{ env.WORKSPACE_NAME }} -y


create-using-builder-yaml:

name: 'Create app using builder with YAML configuration'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -341,6 +387,7 @@ jobs:
run: az acr repository delete -n ${{ vars.TEST_ACR_NAME }} -t ${{ env.TEST_IMAGE_REPOSITORY }}:${{ env.TEST_IMAGE_TAG }} -y

create-using-image-yaml-linux:

name: 'Create app using image with YAML configuration on Linux runner'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -385,6 +432,7 @@ jobs:
run: az containerapp delete -n ${{ env.TEST_CONTAINER_APP_NAME }} -g ${{ vars.TEST_RESOURCE_GROUP_NAME }} -y

create-using-image-yaml-windows:

name: 'Create app using image with YAML configuration on Windows runner'
runs-on: windows-latest
timeout-minutes: 10
Expand Down Expand Up @@ -429,6 +477,7 @@ jobs:
run: az containerapp delete -n ${{ env.TEST_CONTAINER_APP_NAME }} -g ${{ vars.TEST_RESOURCE_GROUP_NAME }} -y

update-using-builder:

name: 'Update existing app using builder'
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -475,6 +524,44 @@ jobs:
shell: bash
run: az containerapp update -n ${{ env.TEST_CONTAINER_APP_NAME }} -g ${{ vars.TEST_RESOURCE_GROUP_NAME }} -i mcr.microsoft.com/azuredocs/containerapps-helloworld:latest

update-using-builder-and-internal-registry:

name: 'Update existing app using builder and push to internal registry'
runs-on: ubuntu-latest
timeout-minutes: 10

env:
TEST_IMAGE_TAG: 'bs-up-${{ github.run_id }}'
TEST_CONTAINER_APP_NAME: 'update-using-builder-app'

steps:
- name: Checkout action repository
uses: actions/checkout@v3

- name: Clone Oryx repository
uses: actions/checkout@v3
with:
repository: microsoft/Oryx
path: oryx

- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.TEST_AZURE_CREDENTIALS }}

- name: Execute Azure Container Apps Build and Deploy Action
uses: ./
with:
appSourcePath: '${{ github.workspace }}/oryx/tests/SampleApps/DotNetCore/NetCore6PreviewWebApp'
containerAppName: ${{ env.TEST_CONTAINER_APP_NAME }}
resourceGroup: ${{ vars.TEST_RESOURCE_GROUP_NO_ACR_NAME }}
disableTelemetry: ${{ vars.TEST_DISABLE_TELEMETRY }}

- name: Update Container App with existing image
if: ${{ always() }}
shell: bash
run: az containerapp update -n ${{ env.TEST_CONTAINER_APP_NAME }} -g ${{ vars.TEST_RESOURCE_GROUP_NO_ACR_NAME }} -i mcr.microsoft.com/azuredocs/containerapps-helloworld:latest

update-using-image:

name: 'Update app using image'
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .gitignore
node_modules/
*.js
!dist/index.js
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ 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 `<container-app-name>-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 `<container-app-name>-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 `<platform>:<version>`. 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. |
| `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-20231004.1", 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. |
| `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-20231107.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. |
| `buildArguments` | No | A list of build arguments provided as KEY=VALUE pairings and are space-separated. If a Dockerfile has been provided or is discovered in the application source, each build argument will be passed to the `docker build` command via the `--build-arg` flag. If the Oryx++ builder is used to create a runnable application image, each build argument will be passed to the `pack build` command via the `--env` flag. |
| `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. |
Expand Down Expand Up @@ -419,6 +420,29 @@ steps:
This will create a new Container App named `github-action-container-app-<github-run-id>-<github-run-attempt>` in a new
resource group named `<container-app-name>-rg` where the runnable application image is using the .NET 7 runtime stack.

### Build Arguments provided

```yml
steps:

- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build and deploy Container App
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ${{ github.workspace }}
acrName: mytestacr
buildArguments: |
"BP_JVM_VERSION=21" "BP_MAVEN_BUILD_ARGUMENTS=-Dmaven.test.skip=false --no-transfer-progress package"
```

This will create a new Container App named `github-action-container-app-<github-run-id>-<github-run-attempt>` in a new
resource group named `<container-app-name>-rg`. The Container App will be based off of an image that was built from
the provided `appSourcePath`. Oryx++ builder is used to create a runnable application image, each build argument will be passed to the `pack build` command via the `--env` flag, e.g., `BP_JVM_VERSION=21 BP_MAVEN_VERSION=4` will be passed to the `pack build` as `--env BP_JVM_VERSION=21 --env BP_MAVEN_VERSION=4`.'

### Dockerfile provided

```yml
Expand All @@ -435,11 +459,13 @@ steps:
appSourcePath: ${{ github.workspace }}
acrName: mytestacr
dockerfilePath: test.Dockerfile
buildArguments: |
"arg-1=value-1" "arg-2=value-2"
```

This will create a new Container App named `github-action-container-app-<github-run-id>-<github-run-attempt>` in a new
resource group named `<container-app-name>-rg` where the runnable application image was created from the `test.Dockerfile`
file found in the provided application source path directory.
file found in the provided application source path directory and build arguments `"arg-1=value-1" "arg-2=value-2"` will be passed to the `docker build` as `--build-arg "arg-1=value-1" --build-arg "arg-2=value-2"`. If there's no build argument in the Dockerfile, no need to provide `buildArguments`.

_Note_: for values provided to `dockerfilePath`, no file prefixes should be included (_e.g._, `./test.Dockerfile` should be
passed as just `test.Dockerfile`). The provided `appSourcePath` and `dockerfilePath` arguments will be concatenated inside
Expand Down
Loading
Loading