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

Conditional matrix building and optional build project stage #148

Open
1 of 4 tasks
samrocketman opened this issue Dec 7, 2022 · 1 comment
Open
1 of 4 tasks
Milestone

Comments

@samrocketman
Copy link
Owner

samrocketman commented Dec 7, 2022

Tasks

  • Filter support with filter tests
  • Implementation
  • Documentation
  • Tests

Defining pipeline context

A pipeline context is the conditions in which a job was built or triggered. For example,

Triggers:

  • Manual trigger
  • Cron trigger
  • PR comment trigger
  • Push trigger

Environment context based on Git workflow:

  • Pull request
  • Branch
  • Tag

Conditional disabling "Build Project"

Also, Matrix building of "Build Project" should be conditional

Support for disabling matrix building based on pipeline context. isBuilding() pipeline step should be internalized into Jervis so that it can be used for filtering. It should be extended so that PR comments are also supported.

build:
  on:
    - pr
    - tag
matrix:
  on:
    pr_comment: '/.*[Bb]uild +[Pp](ull +)?[Rr](equest)? +[Mm]atrix.*/'

The filtering should be context aware and Jervis should be instantiated by loading in the context of the pipeline in which it is building.

Support for disabling building

Add support for

build:
  on: 'never'
jenkins:
  pipeline_jenkinsfile: '.ci/Jenkinsfile'

The following would also produce not ever building.

language: groovy
install: true
script: /bin/true
jenkins:
  pipeline_jenkinsfile: '.ci/Jenkinsfile'

Because it is possible a user only wishes to use Jervis for toolchains and any building would happen in their Jenkinsfile.

A user overriding the install and script for a language to execute the documented no-op build means they only want the toolchains for that given language. to

@samrocketman
Copy link
Owner Author

  • Added a new class FilterByContext which provides all of the flexible filtering required for this feature.
  • Added a new var getBuildContextMap() which returns the context of the build environment to be acted on.
  • Updated isBuilding to use the new filtering class.

0f1c19f...5bba645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant