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

Allow using git tags with seed-jobs #759

Open
DaniJG opened this issue Jun 30, 2022 · 1 comment
Open

Allow using git tags with seed-jobs #759

DaniJG opened this issue Jun 30, 2022 · 1 comment
Labels
enhancement New feature or request not-stale
Milestone

Comments

@DaniJG
Copy link

DaniJG commented Jun 30, 2022

Describe the solution you'd like
I would like to be able to configure the seed jobs to use a specific git tag of the repo.
Currently the Jenkins CRD allows you to specify the repositoryBranch of the created seed jobs, so you could in theory point it to the right tag using refs/tags/<tagName>

 seedJobs:
   - id: my-seed-job
     targets: ...
     description: ...
     repositoryBranch: refs/tags/my-tag
     repositoryUrl: ...

However this doesnt work because the git SCM of the seed job is configured to not pull tags.
This is because the groovy script created for the seed job initializes the extra options for gitSCM as follows (source here):

def gitExtensions = [
	new CloneOption(true, true, ";", 10),
	new GitLFSPull()
]

Where the second boolean of the CloneOption constructor corresponds with the noTags parameter: https://javadoc.jenkins.io/plugin/git/hudson/plugins/git/extensions/impl/CloneOption.html

Ideally the Jenkins CRD would include a new optional boolean parameter to enable fetching of tags in the seed job (defaulted as false), which would be used to control the second boolean parameter of the CloneOption in the generated groovy script:

 seedJobs:
   - id: my-seed-job
     targets: ...
     description: ...
     # using tags is now possible by also including fetchTags: true
     repositoryBranch: refs/tags/my-tag
     fetchTags: true
     repositoryUrl: ...
def gitExtensions = [
        // noTags parameter set as true only when FetchTags is false, and viceversa
	new CloneOption(/* shallow */ true, /* notags */ {{ ! .FetchTags }}, /* reference */ ";", /* timeout */ 10),
	new GitLFSPull()
]

Describe alternatives you've considered
You can only use git branches as the source for the seed job. There is no alternative that lets you use git tags other than manually updating the created seed job to allow fetching tags (but that gets lost if the operator reinitializes jenkins)

Additional context
N/A

@DaniJG DaniJG added the enhancement New feature or request label Jun 30, 2022
@brokenpip3
Copy link
Collaborator

Make sense, great write-up. Will add this fr in the 0.9 queue.

@brokenpip3 brokenpip3 added this to the 0.9 milestone Mar 1, 2023
@github-actions github-actions bot added the stale label May 8, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2023
@brokenpip3 brokenpip3 reopened this May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request not-stale
Projects
None yet
Development

No branches or pull requests

2 participants