openSUSE / doc-ci

Continuous integration for SUSE documentation
4 stars 6 forks source link

Propagate workflow updates automatically #38

Open ghost opened 3 years ago

ghost commented 3 years ago

Currently, whenever the workflow needs to be updated in the content repos, we need to push the diff to a whole bunch of different repos (~10) and branches (~5 per repo).

So far, my tools of choice have been git-format-patch and git-am:

  1. git format-patch -1 SHA
  2. Edit the file names in the patch file to match the content repos.
  3. cd repo
  4. Repeat as necessary:b='branch_name'; git checkout "$b" && git am /patch/to/0001-patch_file.patch && git push
  5. Go to next repo, skip back to (3.)

Cons:

Pros:

Ideas:

ghost commented 3 years ago

@tomschr in #44:


Situation

We've tried to modularize our processes and did a decent share with GitHub Actions (GHA). When we've started with GHA, we weren't able to reuse workflows, only Actions.

Now it's possible to share GitHub workflows. The GitHub workflow contains these lines at the beginning:

on: 
  workflow_call:
    inputs:
      # defines the inputs of this workflow

jobs:
  # contains all the jobs and their steps to complete this workflow

To "call" this workflow in another workflow, use jobs.<job_id>.uses like this:

jobs:
  build:
    uses: openSUSE/doc-ci/.github/workflows/build.yml@main
    # pass inputs of the workflow with the "with" keyword

It's possible to use a different branch or SHA as we've done so for GHA already.

Be aware, reuse of workflows are currently in beta and subject to change.

Suggestion

We should look into this topic again and decide, if it can help to refactor our process workflow and deduplicate GHAs.

References

ghost commented 2 years ago

From the linked docs, #Limitations:

  • Any environment variables set in an env context defined at the workflow level in the caller workflow are not propagated to the called workflow. For more information about the env context, see "Context and expression syntax for GitHub Actions."
  • The strategy property is not supported in any job that calls a reusable workflow.

Not sure if I read this right but both of those limitations sound like they'd kill this for us:

tomschr commented 1 year ago

From the linked docs, #Limitations:

  • Any environment variables set in an env context defined at the workflow level in the caller workflow are not propagated to the called workflow. For more information about the env context, see "Context and expression syntax for GitHub Actions."
  • The strategy property is not supported in any job that calls a reusable workflow.

Not sure if I read this right but both of those limitations sound like they'd kill this for us:

* We need an environment variable for the `gha-publish` job.

* We need the `strategy` property for parallelizing jobs.

The limitation on the strategy property isn't mentioned anymore.

Regarding the environment variables, I don't know. Perhaps it could be passed as an input. :shrug: