-
Notifications
You must be signed in to change notification settings - Fork 395
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
Add Retriever for testing pipeline steps of a project itself. #64
Conversation
The retrievers available up to now are designed for testing a pipeline which makes use of pipeline steps. In the focus of the test is a pipeline, not the pipeline steps provided by a shared lib. The retriever provided here helps with testing pipeline steps provided by a shared lib project itself.
Looks great, but there are no tests. |
Bonjour, thanks a lot for your feedback.
Yes, if there is a significant chance for getting this PR accepted I will provide tests. In that sense the PR is work in progess, but I'm not able to set the corresponding label. IMO it's better to show up with a PR early rather than investing time and finally it gets refused.
We also thought about a copy step. But on our side it is somehow difficult since we have projects on different build systems, (e.g. also maven). The less dependencies to the build system (also as e.g. copy step performed by the build system) the better. Here that would be a minor thing, but as we made that experience on other projects ... |
with regards to new test for project source retriever.
55a0fa4
to
98bcc6c
Compare
Would love to see this or #75 merged and have a supported, recommended and obvious way to test local project source as part of JenkinsPipelineUnit. |
Cool; it would be very helpful to have this. I hacked around the same stumbling block by setting up a symbolic link in the form The one drawback of this hack is that, at least on our Windows machines, we have to be Running as Administrator in order to have the privilege to create a symlink. |
I copied this class in my project to try it out, but I can't get the loaded steps to use any base pipeline step from Jenkins (e.g.
|
src/test/groovy/com/lesfurets/jenkins/TestSharedLibraryWithProjectSourceRetrieverCPS.groovy
Show resolved
Hide resolved
src/test/groovy/com/lesfurets/jenkins/TestSharedLibraryWithProjectSourceRetriever.groovy
Show resolved
Hide resolved
@marcusholl, looks cool, thank you. It also needs resolving of merge-conflicts, could you please do this. |
@stchar: done |
The JenkinsPipelineUnit framework is very helpful for us. We are some developers as SAP developing Jenkins shared libraries. We use the framework for testing our pipeline steps coming from our shared library.
Testing steps contained in a shared library is not the main focus of the JenkinsPipelineUnit framework, as far as we can see. The main focus is testing pipelines itself.
In order to test our shared library itself we introduced another
SourceRetriever
. This source retriever registers the coding of the shared lib located inside the project root folder itself (or to be more precise in. the foldersvars
,src
andresources
which in turn resides in the project root.The already available
SourceRetriever
s are suitable for registering shared libs coming from either a git repo or checked in somewhere into the project sources following a naming convention like$repository@$branch
.Instead of having a dedicated
SourceRetriever
for making pipeline steps contained in the project root itself available it would also be possible to make the pattern mentioned before configurable so that also an empty pattern can be used.We think our use case is in general valid. And this is why we propose our source retriever with this pull request.
Are there other possibilities for testing pipeline steps itself - rather than pipelines - without having another source retriever?