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

Why dont we infer Project id and component from the git url of the repo instead of coding them into the jenkinsfile? #266

Closed
clemensutschig opened this issue Apr 25, 2020 · 4 comments · Fixed by #270 or #284
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@clemensutschig
Copy link
Member

clemensutschig commented Apr 25, 2020

Is your feature request related to a problem? Please describe.
I gave our contributor quickstarter some more thought.. and in order to prevent changes to the jenkins file and other pieces (sonar) that one would have to change back before an upstream contribution, we could infer project id and component id directly from the origin remote url instead of hard coding them into the jenkins file..

the git url pattern is every time similar (because we create it in the prov app):
http(s)://bitbucketHost/scm/projectId/projectId-componentId.git

Describe the solution you'd like
See above

Describe alternatives you've considered
An unmecessary change commit before upstream push.. Error prone

Context:
today: https://github.com/opendevstack/ods-jenkins-shared-library/blob/master/src/org/ods/component/Context.groovy#L252-L260

@clemensutschig clemensutschig changed the title Why dont we infer Project and component from the git url of the repo? Why dont we infer Project id and component from the git url of the repo instead of coding them into the jenkinsfile? Apr 25, 2020
@clemensutschig clemensutschig added the question Further information is requested label Apr 25, 2020
@clemensutschig
Copy link
Member Author

@oalyman / @michaelsauter - also related to #265

@clemensutschig
Copy link
Member Author

This would also allow us to remove the renderjenkinsfile stage.. Another benefit

@clemensutschig
Copy link
Member Author

      def origin = "https://..../scm/opendevstack/ods-jenkins-shared-library.git"
    
      List splittedOrigin = origin.split ("/")
      def project = splittedOrigin[splittedOrigin.size()-2]
      def data = [ 
        "project" : project,
        "component" : splittedOrigin[splittedOrigin.size()-1].replace (".git", "").replace("${project}-","")
      ]

@michaelsauter
Copy link
Member

Rendering would still be required I think, as it does a few more replacements, see https://github.com/opendevstack/ods-jenkins-shared-library/blob/master/src/org/ods/quickstarter/RenderJenkinsfileStage.groovy#L21.

We should still allow setting the project/component explicitly I think. But we could default to values extracted from the origin URL as you suggest, that would be a nice improvement 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
No open projects
2 participants