Skip to content
Open
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
11 changes: 10 additions & 1 deletion .cloudbees/testing/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ inputs:
namespace:
description: 'Kubernetes namespace to install the chart in, created if missing'
default: default
create-namespace:
description: 'Whether to create the namespace if it does not exist'
default: 'true'
version:
description: 'Version of the chart to be installed'
# DEPRECATED: values-file is deprecated, use values-files instead
Expand Down Expand Up @@ -52,6 +55,10 @@ inputs:
CloudBees registry configuration file containing the registries to use for loading images.
By default it uses the file containing the registries configured under 'Integrations' in the CloudBees platform.
default: ${{ cloudbees.registries }}
outputs:
release-revision:
description: 'The helm release revision number after install/upgrade'
value: ${{ steps.helm-install.outputs.release-revision }}
runs:
using: composite
steps:
Expand Down Expand Up @@ -126,7 +133,7 @@ runs:
releases:
- valuesFiles:
- /tmp/values.yaml
createNamespace: true
${{ inputs.create-namespace == 'true' && 'createNamespace: true' || 'createNamespace: false' }}
skipBuildDependencies: true
upgradeOnChange: true
flags:
Expand Down Expand Up @@ -207,11 +214,13 @@ runs:
--create-namespace \
--timeout "$TIMEOUT" \
--dry-run
printf '' > $CLOUDBEES_OUTPUTS/release-revision
else
# Let skaffold deploy the chart to log details on failure
cd /tmp/skaffold
skaffold config set collect-metrics false
skaffold deploy
printf %s "$(helm status "$RELEASE_NAME" -n "$HELM_NAMESPACE" -o yaml | yq '.version')" > $CLOUDBEES_OUTPUTS/release-revision
fi
env:
CHART_LOCATION: ${{ inputs.chart-location }}
Expand Down
51 changes: 50 additions & 1 deletion .cloudbees/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,56 @@ jobs:
namespace: ${{ steps.createns.outputs.name }}
timeout: 1m
wait: 'false'
- name: test startup probe failure scenario
- id: create-namespace-false-existing-ns
name: install a helm chart with create-namespace set to false into existing namespace
uses: ./.cloudbees/testing
with:
release-name: example-no-create-ns
chart-location: charts/example
namespace: ${{ steps.createns.outputs.name }}
create-namespace: 'false'
timeout: 2m
- name: verify create-namespace false into existing namespace produced a release revision
uses: docker://alpine/k8s:1.31.2
run: |
set -ux
[ -n "${REVISION}" ]
env:
REVISION: ${{ steps.create-namespace-false-existing-ns.outputs.release-revision }}
- id: create-namespace-true-new-ns
name: install a helm chart with create-namespace set to true into new namespace
uses: ./.cloudbees/testing
with:
release-name: example-create-ns
chart-location: charts/example
namespace: ${{ format('cn-{0}', cloudbees.scm.sha) }}
create-namespace: 'true'
timeout: 2m
- name: verify create-namespace true into new namespace produced a release revision
uses: docker://alpine/k8s:1.31.2
run: |
set -ux
[ -n "${REVISION}" ]
env:
REVISION: ${{ steps.create-namespace-true-new-ns.outputs.release-revision }}
- id: create-namespace-false-missing-ns
name: install a helm chart with create-namespace false into non-existent namespace
continue-on-error: true
uses: ./.cloudbees/testing
with:
release-name: example-no-ns
chart-location: charts/example
namespace: ${{ format('missing-{0}', cloudbees.scm.sha) }}
create-namespace: 'false'
timeout: 2m
- name: verify create-namespace false into missing namespace produced no release revision
uses: docker://alpine/k8s:1.31.2
run: |
set -ux
[ -z "${REVISION}" ]
env:
REVISION: ${{ steps.create-namespace-false-missing-ns.outputs.release-revision }}
- name: test startup probe failure scenario
continue-on-error: true
uses: ./.cloudbees/testing
with:
Expand Down
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ inputs:
namespace:
description: 'Kubernetes namespace to install the chart in, created if missing'
default: default
create-namespace:
description: 'Whether to create the namespace if it does not exist'
default: 'true'
version:
description: 'Version of the chart to be installed'
# DEPRECATED: values-file is deprecated, use values-files instead
Expand Down Expand Up @@ -52,6 +55,10 @@ inputs:
CloudBees registry configuration file containing the registries to use for loading images.
By default it uses the file containing the registries configured under 'Integrations' in the CloudBees platform.
default: ${{ cloudbees.registries }}
outputs:
release-revision:
description: 'The helm release revision number after install/upgrade'
value: ${{ steps.helm-install.outputs.release-revision }}
runs:
using: composite
steps:
Expand Down Expand Up @@ -126,7 +133,7 @@ runs:
releases:
- valuesFiles:
- /tmp/values.yaml
createNamespace: true
${{ inputs.create-namespace == 'true' && 'createNamespace: true' || 'createNamespace: false' }}
skipBuildDependencies: true
upgradeOnChange: true
flags:
Expand Down Expand Up @@ -207,11 +214,13 @@ runs:
--create-namespace \
--timeout "$TIMEOUT" \
--dry-run
printf '' > $CLOUDBEES_OUTPUTS/release-revision
else
# Let skaffold deploy the chart to log details on failure
cd /tmp/skaffold
skaffold config set collect-metrics false
skaffold deploy
printf %s "$(helm status "$RELEASE_NAME" -n "$HELM_NAMESPACE" -o yaml | yq '.version')" > $CLOUDBEES_OUTPUTS/release-revision
fi
env:
CHART_LOCATION: ${{ inputs.chart-location }}
Expand Down