2.5 KiB
2.5 KiB
gCubeActionExecutor
Starting from a list of git projects and a Bash fragment, for each project, this Jenkins pipeline:
- clone the git repository
- execs the Bash fragment in the root folder of the repository
- pushes back the repository using
git.gcube
as author.
Requirements
- Jenkins ver. 2.164.2 or newer
- Pipeline plugin ver. 2.5 or newer
- Pipeline: SCM Step plugin ver. 2.7 or newer
- Pipeline: Shared Groovy Libraries ver. 2.15 or newer
- User credentials for git.gcube configured on Jenkins. These are needed to set the author of the changes in the repository.
Parameters
- Git Root: The URL of the parent organization that includes all the listed repositories.
- List of Repositories: A plain text file, one line for each Git repository name to update.
- Action Root: The root URL of the Bash fragment to execute.
- Action File: The relative path under the Action Root of a Bash script
How Does It Work
The pipeline:
- clones one repository at the time from Git Root/Repo Name (from the list)
- downloads the action file from Action Root/Action File in the root folder of the repository
- runs the action file using the root folder of the repository as working dir
- pushes the repository back to Gitea
Every change to the Git repository MUST be done by the action file. The pipeline is in charge only to push the repository to the remote origin.
Sample Usage
List of Repositories
52n-wps-algorithm-gcube
52n-wps-server-gcube
about-vre
accept-invite-portlet
accounting-aggregator-se-plugin
accounting-analytics
...
Action File
The following fragment downloads a file named LICENSE.md and adds it to the repository (if it does not exist):
#!/usr/bin/env bash
if [[ ! -f LICENSE.md ]]; then
curl <my URL>/LICENSE.md -o LICENSE.md
git add LICENSE.md
git commit -m "Add LICENSE.md."
fi
References
Wiki doc
License
This project is licensed under the EUPL V.1.1 License.