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

feat(triggers) Adds support for payloadConstraints on property files for build triggers #691

Merged
merged 8 commits into from
Nov 2, 2019

Conversation

linjmeyer
Copy link
Contributor

Implements Spinnaker Issue #5053

Use case is conditionally triggering pipelines after a successful Jenkins build. For example, Jenkins may be setup for builds on all branches but Spinnaker pipelines should only be master. More complex use cases are possible too, like triggering 'stage' pipelines on feature/* branches or when a Jenkins build has something like deploy_target=stage.

  • Adds support for payloadConstrains: {} dictionary for Build triggers (e.g. Jenkins).
  • If payloadConstraints are present, then properties in the properties file must pass the constraints to trigger a build
  • Regexp is supported (works the same as webhook and pub/sub payloadConstraints)
  • Does not support Manual Pipeline triggers (ie: if build 30 fails constraints it can still be manually triggered after the fact)
  • Only tested with Jenkins

I think it will work with other build systems as long as they support properties, but unfortunately I don't have any available to test.

@linjmeyer
Copy link
Contributor Author

I should probably add: I'm not a Java dev and this is my first time contributing to Spinnaker outside the spin cli. Feedback is very welcome

@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • 6923ae3: Added simple jenkins check constraints

  • ab96fe4: Moved logic into BuildHandler

  • 7907f27: removed uneeded code for PipelineInitiator

  • f89f474: Added logging, cleaned up code

  • df3d55d: Reverted static change to getKorkUser

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@cfieber
Copy link
Contributor

cfieber commented Oct 31, 2019

This looks pretty reasonable. Can you add some unit testing around the constraint evaluation?

@linjmeyer
Copy link
Contributor Author

@cfieber done! Let me know what you think, and if you want me to fix the incorrect commit messages.

@cfieber cfieber merged commit 598015b into spinnaker:master Nov 2, 2019
@cfieber
Copy link
Contributor

cfieber commented Nov 2, 2019

Thanks for this!

@emjburns
Copy link
Contributor

emjburns commented Nov 4, 2019

@linjmeyer Thanks for this, this is awesome!

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

Successfully merging this pull request may close these issues.

4 participants