rht-labs / labs-ci-cd

👻UNMAINTAINED - A collection of Red Hat Open Innovation Labs CI/CD components
Apache License 2.0
101 stars 70 forks source link

make-demo-unique appends instead of replacing #123

Closed rdebeasi closed 6 years ago

rdebeasi commented 6 years ago

The make-demo-unique appends the project name instead of replacing it, causing the project name to become longer each time the command is run.

For example, here's the command that I'm currently running:

ansible-playbook ci-playbook.yaml -i inventory/ -e demo_projectname=ryan-test -e scm_ref=HEAD

This results in a project called labs-ci-cd-ryan-test. I'd expect the project to be called ryan-test.

I encountered an unrelated error related to postgresql. I ran the same playbook again, causing my project name to become ryan-test-ryan-test. In params/jenkins/deploy:

NAMESPACE=labs-ci-cd-ryan-test-ryan-test

I'd expect to see this:

NAMESPACE=ryan-test

Running the playbook a few times will cause the project name to exceed the 63-character limit, causing further runs to fail. A short-term workaround is to reset the playbook to its initial state by running git checkout params. (You will lose any config changes that you have made.)

sherl0cks commented 6 years ago

the way we have this written with regex, its a bit of a challenge to do it right. I'm going to be exposing the regexp / replace pairs for end users to modify without changing the role. so if you have regex magic to make it work, a PR will be welcome

I think the shorter answer is simply have the playbook git checkout params as a clean up step and include a warning to users that they need to save local changes first

sherl0cks commented 6 years ago

@rdebeasi ok - I've gotten the regex to the point where it is idempotent, so the playbook can be run many times. it still does a post fix instead of a replace, but this is just the nature of the beast as far as I see it. PR shortly