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

Set custom path for pipeline configuration file in the source code repository #252

Merged

Conversation

Jefffrey
Copy link

PR Details

Enable configuration of custom paths for template and config files when retrieving them from the source code repository for Multibranch projects to address issue #99

Description

TemplateBranchProjectFactory and TemplateMultiBranchProjectFactory have been modified to store a new String configurationPath (which defaults to pipeline_config.groovy) and allows users to specify which path in the repository to fetch the pipeline configuration file from instead of always fetching from root. Also enabled this same selection for the pipeline template file via field String scriptPath which defaults to Jenkinsfile.

MultibranchTemplateFlowDefinition has been updated to account for these fields, and thus the PipelineConfigurationAggregator and PipelineTemplateResolver classes now have extra behaviour for this definition in case a custom path has been specified.

Documentation, resources been updated and a new unit test added.

How Has This Been Tested

Running just test as well as some local testing with just run

Types of Changes

  • Added Unit Testing
  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have added the appropriate label for this PR
  • If necessary, I have updated the documentation accordingly.
  • All new and existing tests passed.

@steven-terrana
Copy link

thanks @Jefffrey!

appreciate the PR - looks great.
testing it out now.

@steven-terrana
Copy link

Thanks for writing the tests. I ran a bunch of manual tests around dot files (.jte.groovy) and nested file paths and it's all working great.

Might be a separate PR.. but..

any thoughts around how you think JTE should handle the situation where the Pipeline Template or the Pipeline Configuration File can't be found?

Right now, JTE doesn't require a repository level Pipeline Configuration file so it doesn't log any output when it doesn't find one.

I feel like if the user defines a specific path, then they're probably anticipating that file be present and we should at least log a warning if it wasn't found or potentially even fail the build.

thoughts?

@steven-terrana steven-terrana added the enhancement New feature or request label Feb 24, 2022
@steven-terrana steven-terrana merged commit e597b23 into jenkinsci:main Feb 24, 2022
@Jefffrey
Copy link
Author

hey @steven-terrana

yeah I agree with the thought process of if they specify a path, it should error if the path doesn't exist. Don't particularly like the thought of the error occurring and being buried in the logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants