-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from WyriHaximus/3.x-make-existing-kubeconfig-…
…overruleable Make existing kubeconfig overruleable
- Loading branch information
Showing
4 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,114 @@ jobs: | |
php -r "exit(trim('${COUNT}') === '0' ? 0 : 255);" | ||
env: | ||
COUNT: ${{ steps.helmlistcountthird.outputs.count }} | ||
tests-helm-install-input-overruled: | ||
name: "Testing Helm Install (input overruled) ${{ matrix.runner }}" | ||
runs-on: ${{ matrix.runner }} | ||
needs: | ||
- runner-matrix | ||
strategy: | ||
matrix: | ||
runner: ${{ fromJson(needs.runner-matrix.outputs.runner) }} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Create k8s Kind Cluster | ||
uses: helm/[email protected] | ||
- name: Get running image ID | ||
id: ps | ||
run: printf "::set-output name=id::%s" $(docker ps --format "{{.ID}}") | ||
env: | ||
IMAGE: ${{ steps.build.outputs.tag }} | ||
- name: Get running image IP | ||
id: inspect | ||
run: printf "::set-output name=ip::%s" $(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${IMAGE_ID}) | ||
env: | ||
IMAGE_ID: ${{ steps.ps.outputs.id }} | ||
- run: sed -i "s/127.0.0.1:32768/${KIND_IP}:6443/g" ~/.kube/config | ||
env: | ||
KIND_IP: ${{ steps.inspect.outputs.ip }} | ||
- name: Make kubeconfig available to Helm3 action | ||
run: | | ||
kubeconfig=$(cat ~/.kube/config) | ||
kubeconfig="${kubeconfig//'%'/'%25'}" | ||
kubeconfig="${kubeconfig//$'\n'/'%0A'}" | ||
kubeconfig="${kubeconfig//$'\r'/'%0D'}" | ||
echo "::set-output name=kubeconfig::$kubeconfig" | ||
id: kubeconfig | ||
- name: List installed packages | ||
uses: ./ | ||
id: helmlistcountfirst | ||
with: | ||
exec: | | ||
printf "count=%s\n" $(helm list | grep ducker-hub-exporter | wc -l) >> $GITHUB_OUTPUT | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
- run: | | ||
php -r "exit(trim('${COUNT}') === '0' ? 0 : 255);" | ||
env: | ||
COUNT: ${{ steps.helmlistcountfirst.outputs.count }} | ||
- name: Install ducker-hub-exporter | ||
uses: ./ | ||
id: helm3 | ||
with: | ||
exec: | | ||
helm repo add WyriHaximusNet https://helm.wyrihaximus.net/ | ||
helm install ducker-hub-exporter WyriHaximusNet/docker-hub-exporter --atomic | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
- name: List installed packages | ||
uses: ./ | ||
with: | ||
exec: | | ||
helm list | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
- run: | | ||
rm ~/.kube -Rf | ||
mkdir ~/.kube | ||
echo "junk" > ~/.kube/config | ||
- name: Get kubeconfig contents | ||
uses: ./ | ||
id: getkubeconfigcontents | ||
with: | ||
exec: | | ||
helm list | ||
printf "::set-output name=cnt::%s" $(cat ~/.kube/config) | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
- name: "Assert kubeconfig really contains: junk" | ||
uses: nick-fields/assert-action@v1 | ||
with: | ||
expected: junk | ||
actual: ${{ steps.getkubeconfigcontents.outputs.cnt }} | ||
- name: List installed packages through a overruled kubeconfig | ||
uses: ./ | ||
id: helmlistcountoverruledkubeconfig | ||
with: | ||
exec: | | ||
helm list | ||
printf "::set-output name=count::%s" $(helm list | grep ducker-hub-exporter | wc -l) | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
overrule_existing_kubeconfig: "true" | ||
- run: | | ||
php -r "exit(trim('${COUNT}') === '1' ? 0 : 255);" | ||
env: | ||
COUNT: ${{ steps.helmlistcountoverruledkubeconfig.outputs.count }} | ||
- run: | | ||
rm ~/.kube -Rf | ||
- name: UnInstall ducker-hub-exporter | ||
uses: ./ | ||
with: | ||
exec: | | ||
helm uninstall ducker-hub-exporter | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
- name: List installed packages | ||
uses: ./ | ||
id: helmlistcountthird | ||
with: | ||
exec: | | ||
helm list | ||
printf "::set-output name=count::%s" $(helm list | grep ducker-hub-exporter | wc -l) | ||
kubeconfig: ${{ steps.kubeconfig.outputs.kubeconfig }} | ||
- run: | | ||
php -r "exit(trim('${COUNT}') === '0' ? 0 : 255);" | ||
env: | ||
COUNT: ${{ steps.helmlistcountthird.outputs.count }} | ||
tests-helm-install-file: | ||
name: "Testing Helm Install (file) ${{ matrix.runner }}" | ||
runs-on: ${{ matrix.runner }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters