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

Generic Prerelease Functionality #34

Merged
merged 9 commits into from
Feb 5, 2024
4 changes: 2 additions & 2 deletions .github/workflows/undeploy-2-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
if: always()
run: |
if [[ "${{ steps.undeploy.outcome }}" == "success" ]]; then
echo "::notice::Deployment ${{ inputs.env-name }} was successfully removed from ${{ inputs.deployment-environment }}"
echo "::notice::Deployment ${{ inputs.env-name }} was successfully removed from ${{ inputs.deployment-environment }}, found at ${{ vars.SPACK_LOCATION }}"
else
echo "::error::Deployment ${{ inputs.env-name }} couldn't be removed from ${{ inputs.deployment-environment}}. Please check manually."
echo "::error::Deployment ${{ inputs.env-name }} couldn't be removed from ${{ inputs.deployment-environment}}, found at ${{ vars.SPACK_LOCATION }}. Please check manually."
fi
74 changes: 42 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,35 @@ This workflow obtains the relevant spack and GitHub Environment information, and

Using the GitHub Environment, it `ssh`s into the deployment environments `spack` instance, and installs the model associated with the repository that called it. It then copies back relevant metadata and creates a versioned GitHub Release in the caller repository, if it is not a `prerelease` deployment.

#### Usage

For supported `spack`-installable ACCESS-NRI models, simply call the `deploy-1-setup.yml` reusable workflow from the given repositories workflow file, as shown below. Don't forget to add required inputs!

```yml
deploy:
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main
with:
version: 1.2.3
secrets: inherit
permissions:
contents: write
```

### `undeploy-*`

For given `spack` environments, we can also remove deployments. For example:

```yml
remove-prereleases:
uses: access-nri/build-cd/.github/workflows/undeploy-2-setup.yml@main
with:
version-pattern: ${{ inputs.model }}-*
secrets: inherit
```

This will remove every `spack` environment from the deployment target that matches `<model>-*`.


#### Inputs

| Name | Type | Description | Required | Default | Example |
Expand All @@ -53,13 +80,27 @@ This workflow obtains the relevant spack and GitHub Environment information, and

Using the GitHub Environment, it `ssh`s into the deployment environments `spack` instance, and installs the model associated with the repository that called it. It then copies back relevant metadata and creates a versioned GitHub Release in the caller repository, if it is not a `prerelease` deployment.

#### Usage

For given `spack` environments, we can also remove deployments. For example:

```yml
remove-prereleases:
uses: access-nri/build-cd/.github/workflows/undeploy-2-setup.yml@main
with:
version-pattern: ${{ inputs.model }}-pre*
secrets: inherit
```

This will remove every `spack` environment from the deployment target that matches `<model>-pre*`.

### `validate-json.yml`

This workflow is used to validate the `config` folders `*.json` files based on their associated `*.schema.json`. This is used for PR checks on the `build-cd` repo itself.

### `create-deployment-spack.yml`

This workflow is used to create a version of `spack` on `Gadi`.
This workflow_dispatch-triggered workflow is used to create a version of `spack` on `Gadi`.

#### Inputs

Expand All @@ -69,34 +110,3 @@ This workflow is used to create a version of `spack` on `Gadi`.
| `spack-packages-version` | string | A version of ACCESS-NRI/spack-packages to be bundled with the install of `spack` | true | `main` | `2023.11.12` |
| `spack-config-version` | string | A version of ACCESS-NRI/spack-config to be bundled with the install of `spack` | true | `main` | `2024.01.01` |
| `deployment-location` | true | A path in the deployment environment where Spack should be created. For example, if it is `opt/spack`, spack will be installed under `opt/spack/<spack-version>/` | true | N/A | `/opt/spack` |

## Usage

### Deployment

For supported `spack`-installable ACCESS-NRI models, simply call the `deploy-1-setup.yml` reusable workflow from the given repositories workflow file, as shown below. Don't forget to add required inputs!

```yml
deploy:
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main
with:
type: release
version: 1.2.3
secrets: inherit
permissions:
contents: write
```

### Removing Deployment

For given `spack` environments, we can also remove deployments. For example:

```yml
remove-prereleases:
uses: access-nri/build-cd/.github/workflows/undeploy-2-setup.yml@main
with:
version-pattern: ${{ inputs.model }}-pre*
secrets: inherit
```

This will remove every `spack` environment from the deployment target that matches `<model>-pre*`.
Loading