Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions crunchy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ The action accepts the following inputs:
| `s3_bucket` | S3 bucket for backups | |
| `s3_endpoint` | S3 endpoint for backups | |
| `force_cleanup` | Force cleanup of the database | false |
| `directory` | Directory containing the Crunchy chart | charts/crunchy |
| `repository` | GitHub repository (e.g., org/repo) | bcgov/action-crunchy |
| `ref` | Git ref to use (e.g., branch, tag, SHA) | main |
| `directory` | Chart directory inside `repository` (only with `repository`) | charts/crunchy |
| `repository` | Repository to take the chart from (e.g., org/repo); omit to use the chart bundled with this action | (bundled chart) |
| `ref` | Git ref of `repository` (e.g., branch, tag, SHA) | main |
| `release_name` | The release name to use, if provided overrides the computed pg-md5hash(1-8) of github repo name, if release_name is `pg-abc`,postgres cluster created will be `pg-abc-crunchy` | |
| `diff_branch` | The branch to diff against (if not using default branch) Optional | |
| `github_token` | (Optional) GitHub (built-in or PAT) token, otherwise inherited from workflow token | `github.token` |
Expand Down
17 changes: 13 additions & 4 deletions crunchy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ inputs:
required: false
type: boolean
directory:
description: 'Crunchy Chart directory'
description: 'Chart directory inside `repository`; only used when `repository` is set'
default: 'charts/crunchy'
validation: "^.+$"
required: false
github_token:
description: Specify token (GH or PAT), instead of inheriting one from the calling workflow
default: ${{ github.token }}
repository:
description: 'GitHub repository; e.g. org/repo'
default: bcgov/action-crunchy
description: 'Repository to take the chart from, e.g. org/repo; omit to use the chart bundled with this action'
default: ''
required: false
validation: "^[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+$"
ref:
Expand Down Expand Up @@ -189,7 +189,8 @@ runs:
repository: ${{ github.repository }} # Always use the downstream
ref: ${{ github.event.pull_request.base.ref || github.ref }} # repository to run diffs!

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- if: inputs.repository != ''
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
Comment thread
DerekRoberts marked this conversation as resolved.
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
Expand All @@ -199,6 +200,7 @@ runs:
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
DIRECTORY: ${{ inputs.directory }}
CHART_REPOSITORY: ${{ inputs.repository }}
REPO_NAME: ${{ github.event.repository.name }}
TRIGGERED: ${{ steps.triggers.outputs.triggered }}
S3_ACCESS_KEY: ${{ inputs.s3_access_key }}
Expand All @@ -208,6 +210,13 @@ runs:
run: |
# Deploy the database

# Bundled chart unless a chart repository was given; copied so the action directory stays untouched
if [ -z "${CHART_REPOSITORY}" ]; then
DIRECTORY="$(mktemp -d)"
trap 'rm -rf "${DIRECTORY}"' EXIT
cp -r "${GITHUB_ACTION_PATH}/charts/crunchy/." "${DIRECTORY}"
fi

# Check if S3 inputs are provided and construct the deploy_db.sh command accordingly
PARAMS="${DIRECTORY} ${VALUES_URL} ${REPO_NAME} ${RELEASE_NAME} ${TRIGGERED}"
if [ -n "${S3_ACCESS_KEY}" ] && [ -n "${S3_SECRET_KEY}" ] && [ -n "${S3_BUCKET}" ] && [ -n "${S3_ENDPOINT}" ]; then
Expand Down
Loading