oracle-actions / configure-kubectl-oke

Install and configure Kubectl for the specified Oracle Engine for Kubernetes (OKE) cluster
Universal Permissive License v1.0
11 stars 9 forks source link

How can this support mutiple regoins without having to copy and paste whole workflow? #25

Closed davem-git closed 7 months ago

davem-git commented 8 months ago

How can this support multiple regions without copying and pasting the whole workflow?

can the region be added to be passed in as an input?

Djelibeybi commented 8 months ago

You can just override the OCI_CLI_REGION environment variable for each step that calls configure-kubectl-oke.

davem-git commented 7 months ago

Thats not a great solution. That requires me to duplicate blocks of code. Where as I can setup a a matrix list of clusters, store the region with it and loop through them all in one block.

Djelibeybi commented 7 months ago

You could use a matrix for this as well by providing the matrix output to an env: block within the step itself, which will override the job-level env setting.

davem-git commented 7 months ago

Could you provide a sample?

Djelibeybi commented 7 months ago

Something like this should work:

jobs:
  example_matrix:
    strategy:
      matrix:
        region: ["us-ashburn-1", "us-phoenix-1", "au-melbourne-1"]
    steps:
      - uses: oracle-actions/configure-kubectl-oke@v1.3.2
        env:
          OCI_CLI_REGION: ${{ matrix.region }}

I've left out some required fields just for brevity to show how the matrix values could be used. You'd want to combine this with your existing workflow.

davem-git commented 7 months ago

that worked great. Might be worth adding it to the readme. This can be closed