Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge inhouse and non inhouse pipelines #22

Open
skifahrer opened this issue Jun 4, 2024 · 0 comments
Open

merge inhouse and non inhouse pipelines #22

skifahrer opened this issue Jun 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@skifahrer
Copy link

'm starting to think that splitting this into two files wasn't the best idea. We are just copying the same code twice. Which goes directly against DRY principle.

My suggestion would be to keep just one file - .github/workflows/create-kustomize-with-bratiska-cli-inhouse.yml and drop "-inhouse" from the name. Then if you would like to run it on GitHub runners, you can just specify

runs-on: ['ubuntu-latest']
and it does the same thing and it is almost as many characters as specify "-bratiska-cli.yml" or "-bratiska-cli-inhouse.yml". Or, if you would like to be even more user friendly, you can just rework this into:

  runs-on:
    description: "Define environment where the job will run. Possible values: ['github', 'inhouse']"
    type: choice
    options: 
      - github
      - inhouse
    required: false
    default: 'inhouse'

Then you can just have a basic step that makes that decision inside a pipeline

  - name: Pick a runner
    run: |
      if [[ "${inputs.runs-on}" == "github" ]]; then
          # print and set env variable
      elif [[ "${inputs.runs-on}" == "inhouse" ]]; then
          # print and set env variable
      else
          # throw an error about unknown runner environment
      fi

This leaves the door open for multiple environments in the future and is still as user friendly as possible and you can easily switch just by specifying different input.

I'm flagging this here, as .github/workflows/create-kustomize-with-bratiska-cli-inhouse.yml and .github/workflows/create-kustomize-with-bratiska-cli.yml are new files and we can easily change it here. We don't have to make this change now for all of the files and all of the repositories. That can be pushed to latter PRs/changes.

@skifahrer skifahrer added the enhancement New feature or request label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant