kbase / .github

MIT License
0 stars 6 forks source link

Removed the dependency of curl command from the pr_build and production_release.yaml file. #5

Closed ialarmedalien closed 2 years ago

ialarmedalien commented 2 years ago

There's no need to have separate script files or to run curl commands to pull in scripts from another repo -- you can do it all natively in GitHub actions.

See the GitHub actions docs:

The narrative repo has examples of workflow reuse, as well as eliminating the extra scripts in favour of using just the workflow yaml files.

bio-boris commented 2 years ago

@ialarmedalien Are you proposing eliminating ALL script files in favor of completely doing everything in YAML files, or just some of them? Do these scripts have to live inside YAML files and then you replace https://github.com/kbase/.github/blob/dbc4b3eab7a738808437343f69292272af6fd42c/workflow-templates/pr_build.yaml#L36 and https://github.com/kbase/.github/blob/dbc4b3eab7a738808437343f69292272af6fd42c/workflow-templates/pr_build.yaml#L47 to instead call these new yaml workflows?

Also, If there is branching logic, can this still be achieved in YAML files?

ialarmedalien commented 2 years ago

Instead of running the curl command, you can call a local or remote workflow, e.g.

name: Build Dev Image

jobs:
  run_build_and_push:
    # use a workflow available across the kbase org
    uses: kbase/.github/workflows/build_and_push_image.yml
    secrets:
      GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
      GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}

  run_unit_tests:
    # use a workflow from the current repo
    uses: ./.github/workflows/unit_test.yml
    needs: run_build_and_push

You can execute shell script as a step in a workflow job, and the shell script that's used in the scripts in this repo is all simple enough that it's easily transferrable to the workflow file.

Branching logic is achievable -- there's the if conditional that you can use to control whether or not a job or a step within a job is run.

jsfillman commented 2 years ago

This should be done for pr_build.yaml, see #19.

jsfillman commented 2 years ago

Closing, as task is being tracked in DEVOPS-783.