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

Shorter syntax for configrepo preflight; add .gocd-cli.yaml file #40

Open
tomzo opened this issue May 1, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@tomzo
Copy link
Contributor

commented May 1, 2019

Currently, in order to validate a repository with preflight api we use following command:

gocd configrepo --yaml preflight -r my-existing-repo my-pipeline.gocd.yaml

Or for many files something like

gocd configrepo --yaml preflight -r my-existing-repo *.gocd.yaml

It makes sense, all arguments are absolutely required for the API call.

Feature proposition

I'd like to propose following convention, in order to shorter above commands.

In config-repo users would add a file, say .gocd-cli.yaml with following content

---
config_repo_id: my-repo-id
plugin_id: yaml.config.plugin
file_pattern: "**/*.gocd.yaml"
registered: true

The gocd-cli would search for such file in current directory. If file is found, then these values can be used instead providing them each time as arguments.

Benefits

  • The result, would shorten the command to just
gocd configrepo preflight
  • It is also much less error prone. Getting the repo_id right can be annoying.

My point is that all these values are pretty much constant throughout the lifespan of the configuration repository - same repo_id, same plugin, same file pattern.

Extension in the longer term

I suppose gocd-cli could be used in the future to add config repository to gocd through API, without ever going into the UI.
There could be an operation like this

gocd configrepo new -r my-new-id --yaml

It would:

  • create a boiler plate ci.gocd.yaml file
  • generate .gocd-cli.yaml with extra field registered: false to point that repo is not on gocd server yet.

Then user edits the ci.gocd.yaml as needed. During this time it is already OK to run:

gocd configrepo preflight

Then user runs

gocd configrepo register

which adds repo to GoCD.
Then commit and push.

@arvindsv @marques-work what do you think?

@arvindsv

This comment has been minimized.

Copy link

commented May 2, 2019

@tomzo All that looks good to me. Anything to make it easier to use, I'm on board for. We need to put in a little bit of work soon towards this, to make it easier to use. At the very least, we need to make a release of this and make it easy to find and use.

@marques-work

This comment has been minimized.

Copy link
Collaborator

commented May 2, 2019

@arvindsv @tomzo regarding configrepo crud operations, I've already built that. I've got it in a local stash that I haven't pushed up yet because I wanted to review the interface again to make sure it feels consistent.

However, I never considered having a flag to control registration as @tomzo suggested. Currently, it's really a convenience over the API, but is pretty raw. I'll push that soon, and perhaps we can iterate over this idea and get it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.