3

What's the equivalent GitLab's extends keyword in GitHub Actions?

I want to migrate from GitLab to GitHub Actions, but I can't find constructs similar to GitLab's extends keyword and child pipelines to reuse functionality and refactor workflows.

More concretely, in GitLab I have the following job, which all other jobs extend for them to run inside Docker containers (I don't want to specify the container image for every job):

.common:
  tags:
    - amd64
  image:
    name: registry.gitlab.io/build-platform/imported/foundation/pro-bff/build-env:py310
Shuzheng
  • 11,288
  • 20
  • 88
  • 186
  • That's quite a question, as IIRC no such equivalent exists. _What_ I know in this context is that the YAML parser Microsoft uses on its global Github deployment does **not** support the [Merge Key Language-Independent Type for YAML™ Version 1.1 Working Draft 2005-01-18](https://yaml.org/type/merge.html). Therefore one approach could be to use the YAML in the Gitlab CI syntax as templates to generate its Github Actions equivalent YAML. As the configuration needs to ship within the repository, each transformation needs a commit (at least an amend), but still the GH API is pretty fast (1/2) – hakre Jul 04 '23 at 21:19
  • (2/2) spinning up new repositories and then running the actions within them so it is easy to test. You can get this fly just with throw-away repos until the outcome looks good. I found this faster than using the local act runner which surprised me as I normally favor a local build over remote. But somehow act does not deliver well (enough) compared to setting up actual repos on Github, pushing to them and then burning them down. – hakre Jul 04 '23 at 21:21
  • Thank you. This seem quite complicated thus :) Could you provide a link to a relevant reference to get me started? – Shuzheng Jul 05 '23 at 12:01
  • About which part? And are you using any dynamic language like python or similar? – hakre Jul 05 '23 at 12:55
  • Both parts. And yes, I'm using Python :) – Shuzheng Jul 10 '23 at 12:50

0 Answers0