From 84e24b2a8411d21b3f5eb2ab93d44c651549b44f Mon Sep 17 00:00:00 2001 From: Cirrus-8691 <52166657+Cirrus-8691@users.noreply.github.com> Date: Sat, 1 Jun 2024 12:15:07 +0200 Subject: [PATCH 1/3] Using kubectl ouput --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f3f37a5..cf7e168 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,22 @@ To use kubectl put this step into your workflow: args: get pods ``` +### Using kubectl ouput: +```yaml + - name: 🛂 Check namespace exists + uses: actions-hub/kubectl@master + with: + redirect-to: NAMESPACE_EXIST + args: get namespace ${{ env.EXPECTED_NAMESPACE }} --ignore-not-found + + - name: 🛡️ Preserve secret FRONT_TLS + if: env.NAMESPACE_EXIST == ${{ env.EXPECTED_NAMESPACE }} + uses: actions-hub/kubectl@master + with: + redirect-to: WEBAPP_TLS + args: get secret webapp-tls -n ${{ env.EXPECTED_NAMESPACE }} -o yaml +``` + ## Environment variables All these variables need to authorize to kubernetes cluster. I recommend using secrets for this. @@ -125,4 +141,4 @@ To use a specific version of kubectl use: ``` ## Licence -[MIT License](https://github.com/actions-hub/kubectl/blob/master/LICENSE) \ No newline at end of file +[MIT License](https://github.com/actions-hub/kubectl/blob/master/LICENSE) From 6983142ba8f0c589cec2a3b2f6207c0a21de296f Mon Sep 17 00:00:00 2001 From: Cirrus-8691 <52166657+Cirrus-8691@users.noreply.github.com> Date: Sat, 1 Jun 2024 12:16:02 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf7e168..4fa0fbf 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ To use kubectl put this step into your workflow: args: get pods ``` -### Using kubectl ouput: +### Using kubectl ouput ```yaml - name: 🛂 Check namespace exists uses: actions-hub/kubectl@master From 7b7db0ec8238bead6ff83d345e3df759049eed9c Mon Sep 17 00:00:00 2001 From: Cirrus-8691 <52166657+Cirrus-8691@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:31:17 +0200 Subject: [PATCH 3/3] EXPECTED_NAMESPACE=namespace/$NAMESPACE --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4fa0fbf..e98841e 100644 --- a/README.md +++ b/README.md @@ -41,18 +41,19 @@ To use kubectl put this step into your workflow: ### Using kubectl ouput ```yaml + - run: echo "EXPECTED_NAMESPACE=namespace/$NAMESPACE" >> $GITHUB_ENV - name: 🛂 Check namespace exists uses: actions-hub/kubectl@master with: redirect-to: NAMESPACE_EXIST - args: get namespace ${{ env.EXPECTED_NAMESPACE }} --ignore-not-found + args: get namespace ${{ env.NAMESPACE }} -o name --ignore-not-found - - name: 🛡️ Preserve secret FRONT_TLS - if: env.NAMESPACE_EXIST == ${{ env.EXPECTED_NAMESPACE }} + - name: 🛡️ Preserve secret WEBAPP_TLS + if: env.NAMESPACE_EXIST == env.EXPECTED_NAMESPACE uses: actions-hub/kubectl@master with: redirect-to: WEBAPP_TLS - args: get secret webapp-tls -n ${{ env.EXPECTED_NAMESPACE }} -o yaml + args: get secret webapp-tls -n ${{ env.NAMESPACE }} -o yaml ``` ## Environment variables