Skip to content

Conversation

etene
Copy link

@etene etene commented Jun 29, 2018

Hello,

I've implemented a feature I needed, variable substitution in commands. It essentially allows using variables like $ref or $sha in commands in the config file. They are substituted with values taken from the hook request payload.

I've also refactored the code a bit (a lot), and added tests run with tox. I'll probably make the Github CI run it later on.

It would be great if you could consider merging. Of course if it's not the direction you want to take your project to, no problem, I'll just keep my fork :) Also if you have suggestions, they're welcome.

Thanks !

@drzraf
Copy link
Collaborator

drzraf commented Oct 3, 2018

A refactor already happened in (now merged) #2 and #3.
The part about tests is nice, could it be introduced in a separate PR?

About substitution, I'd prefer that command (string) goes through a simple python.format() to which JSON object is passed.
That way:

  • no mess with the payload
  • apply to any payload format (pipeline hook or any other...)
  • code stays slim
  • people may use python substitution expression like {project.foo.bar}
  • I think substitution should be optional to avoid messing with command/shell expressions relying upon brackets.

@etene
Copy link
Author

etene commented Oct 17, 2018

Hello,
No problem, I'll try to get back on it and open a separate PR for the tests when I have time.

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

Successfully merging this pull request may close these issues.

2 participants