-
Notifications
You must be signed in to change notification settings - Fork 282
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
Enable versioning for jenkins shared libraries #2489
Comments
Researched a bit on pulling different versions for remote jenkins shared libraries, and found this plugin https://plugins.jenkins.io/workflow-cps-global-lib-http/ Few things to keep in mind:
|
+1 on separating the library into a new repository and automating away builds/releases |
This is even possible with git, separating out is good, if so then we should consider separating out the python workflows as well. What is propose is? Upon every merge to Publish this zip file to maven Now for every Jenkinsfile (distribution builds or client releases), the 1st stage would always be getting the right compatible version zip and extracting it, so that the code base is now on local workspace which facilities the next stages of execution. With this versioning is enabled for the main code (shared libraries and and python code), which eliminates the branching if organized properly what can go into the zip file. |
I think we are complicating this by mixing 2 things, python build code and jenkins shared library. |
All I'm thinking is versioning the entire code and inside that code we can choose if we want shared libraries or normal workflows, I dont deny its easy to separate the shared libraries and version it, but its always a hanging piece to maintain, from rest of the code base, with this I'm open for thoughts. |
I would recommend moving forward with separate repo for Jenkins shared library for now to unblock the progress and follow up on other items soon as required. @prudhvigodithi @gaiksaya |
Sounds good. In that case I don't think we need to publish at all as git tags can be used by remote repositories to use a particular version of shared libraries using dynamic retrieval method https://www.jenkins.io/doc/book/pipeline/shared-libraries/#dynamic-retrieval |
Listing down the files/folders that need to be moved to new repository:
We need to make sure that the code inside this libraries are not cloning main branches of build repo else versioning is irrelevant. Also we have been confusing these jenkins shared libraries as methods which is not right. Libraries should be generic. Once the libraries are moved, the current as well as future jenkins file will use this libraries as below:
Resources to move this libraries while preserving the history: https://medium.com/@ayushya/move-directory-from-one-repository-to-another-preserving-git-history-d210fa049d4b cc: @opensearch-project/engineering-effectiveness |
Just thinking out of the scope of this issue. My thought earlier was to ship the entire build repo as a separate version, which I have proposed here , where each required use case can pick up the right version zip and then it has all the logic of shared libs, workflows etc. If we are separating out just entity of the build repo, we should then consider making it as loosely coupled as possible. We have to take a call, once we separate out the the shared libs to a new repo, for build repo considering the jenkinsfiles will be hosted in the respective component repo as per the universal build plan, we dont need to go with proposed branching anymore. The shared libs which is possible for a frequent change are versioned based on tags in new repo.
For this I agree we have to remove that logic where it looks for a specific branch, instead the libraries should call the code that is part of the workspace. In future If required we can create a new repo even for the entire workflow source code, but at this point its compatible to build with multiple versions. Image the workflow source code is separated into a new repo, then there would be 2 stages in jenkinsfile one is to load the shared libraries using
To summarize: |
[Offline discussion] Apart from shared libraries, we would still need branching or code separation for build side of things. Example: OpenSearch makes some huge change in upcoming 3.x that changes the rpm spec file or tar-install.sh script. In that case the changes to build code should be only concerned to 3.x and not 2.x. We do not have a mechanism today to separate that out. As for shared libraries, few jenkins libraries like rpmDistValidation needs to move out of the groovy code and converted to python code to make it easier for the any user to even run it locally which is not possible today. We will be moving ahead with separating the code base into new GitHub repo called |
Jenkins shared libraries are now separate into new repository: https://github.com/opensearch-project/opensearch-build-libraries Closing this issue! |
Problem:
Since the jenkinsFile for individual client or any component repositories will be living in the respective GitHub repository, the share jenkins library stored in opensearch-build repo will act as upstream library for all actions.
If not versioned, a breaking change can be introduced causing the non-exercised release workflows in remote repositories to break.
Acceptance Criteria:
The text was updated successfully, but these errors were encountered: