{"id":14008253,"url":"https://github.com/samrocketman/jenkins-bootstrap-shared","last_synced_at":"2025-05-16T01:04:49.301Z","repository":{"id":41377449,"uuid":"99387901","full_name":"samrocketman/jenkins-bootstrap-shared","owner":"samrocketman","description":"Jenkins as immutable infrastructure made easy.  A repository of shared scripts meant to be used as a git submodule.  Packing Jenkins, plugins, and scripts into immutable packages and images.","archived":false,"fork":false,"pushed_at":"2025-04-30T22:15:37.000Z","size":482,"stargazers_count":330,"open_issues_count":4,"forks_count":126,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-30T23:25:08.868Z","etag":null,"topics":["automation","bootstrap","bootstrap-script","deb","docker-compose","hacktoberfest","immutable-infrastructure","jenkins","jenkins-cli","jenkins-configuration","jenkins-installation","packaging","rpm","script-console","vagrant"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samrocketman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-05T00:02:21.000Z","updated_at":"2025-04-30T22:15:40.000Z","dependencies_parsed_at":"2024-08-10T11:02:53.084Z","dependency_job_id":"868c22c3-12eb-49ab-9bcc-0187e9e20789","html_url":"https://github.com/samrocketman/jenkins-bootstrap-shared","commit_stats":{"total_commits":319,"total_committers":6,"mean_commits":"53.166666666666664","dds":"0.018808777429467072","last_synced_commit":"5b68bed53e10a5e9bd3bee75220932670209c32a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fjenkins-bootstrap-shared","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fjenkins-bootstrap-shared/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fjenkins-bootstrap-shared/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samrocketman%2Fjenkins-bootstrap-shared/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samrocketman","download_url":"https://codeload.github.com/samrocketman/jenkins-bootstrap-shared/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","bootstrap","bootstrap-script","deb","docker-compose","hacktoberfest","immutable-infrastructure","jenkins","jenkins-cli","jenkins-configuration","jenkins-installation","packaging","rpm","script-console","vagrant"],"created_at":"2024-08-10T11:01:30.469Z","updated_at":"2025-05-16T01:04:49.281Z","avatar_url":"https://github.com/samrocketman.png","language":"Groovy","readme":"# jenkins-bootstrap shared scripts\n\n\u003cimg\nsrc=\"https://user-images.githubusercontent.com/875669/35621130-2acb1e78-0638-11e8-8777-0f56edc79c32.png\"\nheight=48 width=48 alt=\"Jenkins CI logo\" /\u003e \u003cimg\nsrc=\"https://user-images.githubusercontent.com/875669/35621286-b3d3b9b4-0638-11e8-956c-169993f8042e.png\"\nheight=48 width=48 alt=\"Ubuntu Logo\" /\u003e \u003cimg\nsrc=\"https://user-images.githubusercontent.com/875669/35621322-cf8ec752-0638-11e8-8dbc-72760b696d64.png\"\nheight=48 width=48 alt=\"Red Hat Logo\" /\u003e \u003cimg\nsrc=\"https://user-images.githubusercontent.com/875669/35621353-e78a6956-0638-11e8-8e07-3d96e9e91dd7.png\"\nheight=48 width=72 alt=\"Docker Logo\" /\u003e \u003cimg\nsrc=\"https://user-images.githubusercontent.com/875669/35621372-f72f6d16-0638-11e8-93d6-2ae335fc2382.png\"\nheight=48 width=48 alt=\"Vagrant Logo\" /\u003e\n\n- Jenkins as immutable infrastructure made easy.\n- See a [real world example][jbj].\n\nJenkins is traditionally challenging to safely QA and test upgrades.  This\nproject aims to make safely managing a Jenkins instance and all of its plugins\neasy.\n\nGoals of this project:\n\n- Keep the bulk of the logic in a shared project (this one).\n- Allow other projects to source this project making changes easy to read in\n  downstream projects.\n- Provide a standard bootstrapper across all downstream projects.\n\n# Requirements\n\n- Mac OS X or Linux.\n- GNU awk.  Not installed by default on Mac but available via Homebrew.  `brew\n  install gawk`\n- More than two CPU cores recommended.\n- More than 6GB of RAM recommended if running Jenkins.\n\nOptional requirements for other types of provisioning:\n\n- [Docker][docker]\n- [Vagrant][vagrant] + [VirtualBox][vbox]\n\n# Getting Started\n\nHow to use this shared bootstrapper with your own scripts.\n\n### Creating a new Jenkins instance\n\nIf you're installing Jenkins for the first time then start here.  Otherwise,\nskip to the next section.\n\n1. Create a new repository.\n\n   ```bash\n   mkdir my-project\n   cd my-project\n   git init\n   git submodule add https://github.com/samrocketman/jenkins-bootstrap-shared\n   ./jenkins-bootstrap-shared/init.sh\n   git add -A \u0026\u0026 git commit -m 'initial commit'\n   ```\n\n2. Bootstrap your new Jenkins version locally.\n\n   ```bash\n   ./jenkins_bootstrap.sh\n   ```\n\n3. Visit `http://localhost:8080/` and install all desired plugins.  Be sure to\n   continue as admin.  To simplify upgrading in the future adding the plugin IDs\n   of Jenkins plugins you install to `pinned-plugins.txt` will help keep your\n   infrastructure healthy in future upgrades.  See the [Upgrade Jenkins and\n   plugins](#upgrade-jenkins-and-plugins) section below to learn more.\n\n4. Save your Jenkins version and plugins to your new repository.\n\n   ```bash\n   ./jenkins-bootstrap-shared/scripts/upgrade/upgrade_build_gradle.sh\n   git add -A \u0026\u0026 git commit -m 'plugins are installed'\n   ```\n\n\u003e **Note:** sometimes upgrading plugins can be unstable from the community.\n\u003e When this happens it may be desirable to upgrade specific plugins but not all\n\u003e plugins.  In this case, you can save the plugins of the local Jenkins\n\u003e instance without upgrading all plugins.  The following is an example.\n\u003e\n\u003e     export NO_UPGRADE=1\n\u003e     ./jenkins-bootstrap-shared/scripts/upgrade/upgrade_build_gradle.sh\n\n### Import an existing Jenkins instance\n\nOften, readers will already have an existing Jenkins instance.  These\ninstructions allow one to convert an existing instance to using these bootstrap\nscripts.  To do this, administer privileges are required on the exiting Jenkins\ninstance.\n\n1. Create a new repository.\n\n   ```bash\n   mkdir my-project\n   cd my-project\n   git init\n   git submodule add https://github.com/samrocketman/jenkins-bootstrap-shared\n   ./jenkins-bootstrap-shared/init.sh\n   git add -A \u0026\u0026 git commit -m 'initial commit'\n   ```\n\n2. Prepare authentication for your remote Jenkins instance.\n\n   ```bash\n   export NO_UPGRADE=1\n   export JENKINS_WEB='https://jenkins.example.com/'\n   export JENKINS_USER=\"\u003cyour username\u003e\"\n   export JENKINS_PASSWORD\n   read -ersp 'Password: ' JENKINS_PASSWORD\n   ```\n\n3. Import your remote Jenkins version and plugin versions into this repository.\n\n   ```bash\n   ./jenkins-bootstrap-shared/scripts/upgrade/upgrade_build_gradle.sh\n   git add -A \u0026\u0026 git commit -m 'plugins are installed'\n   ```\n\n### Defining custom plugins\n\nBy creating a `custom-plugins.txt` file at the root of your repository, plugins\ncan be hard coded to specific versions.  Why is this necessary?\n\n- Internal only company plugins can be installed via maven.\n- Install plugins not available in the Jenkins Update Center (i.e. formerly\n  removed).  In general, this is not a good idea but for advanced users may be\n  okay.\n- When importing an existing Jenkins instance, it is possible that the group is\n  wrong for older versions of plugins.\n\nThe format of `custom-plugins.txt` is the following.  Everything else is treated\nas a comment.\n\n- `group:artifact:version@hpi`\n- `group:artifact:version@jpi`\n\nExample `custom-plugins.txt` file:\n\n    # An internal only plugin\n    com.example:myplugin:0.1@hpi\n\n# Next steps\n\nIn the root of your new bootstrap repository there is `variables.gradle`.\nCustomize this to your liking for your setup.  When you're finished I recommend\ntagging your repository as a release.\n\nGenerate RPM and DEB packages of your Jenkins instance.\n\n    ./gradlew packages\n\nThe system packages will be located in `./build/distributions/`.  Your packages\nare ready to manage a new Jenkins installation or convert an existing\ninstallation.  These packages can be used to test upgrades before they ever land\nin production.\n\nAdditionally, this package will track your `$JENKINS_HOME` with `git` during\nplugin upgrades and take daily snapshots of your `$JENKINS_HOME`.\n\n# Common gradle tasks\n\nThe following tasks would be executed with `./gradlew TASK`.  List of common\nTASKs include:\n\n- `clean` - cleans the build directory and all bootstrap related files.\n- `buildRpm` - builds an RPM package for RHEL based Linux distros.\n- `buildDeb` - builds a DEB package for Debian based Linux distros.\n- `buildTar` - builds a TAR file which is used to build a docker container.\n- `packages` - executes `buildRpm`, `buildDeb`, and `buildTar` tasks.\n- `getjenkins` - Downloads `jenkins.war` to the current directory.\n- `getplugins` - Downloads Jenkins plugin HPI files to `./plugins`.\n\n\n# Additional Instructions\n\n### Provision Jenkins via Vagrant\n\nThis repository optionally uses [Vagrant][vagrant].  To bootstrap Jenkins simply\nrun the following to start Jenkins.\n\n    vagrant up\n    export VAGRANT_JENKINS=1\n    ./jenkins_bootstrap.sh\n\nVisit `http://localhost:8080/` to see Jenkins running.\n\n### Provision Jenkins via docker-compose\n\nBootstrapping Jenkins while using docker-compose is similar to bootstrapping\nwith Vagrant.\n\n    export DOCKER_JENKINS=1\n    docker-compose up -d\n    ./jenkins_bootstrap.sh\n\nAlternatively, the following command will bring up Jenkins and force a rebuild\nof the docker image.\n\n    docker-compose up --build -d\n\nStop and start Jenkins using `docker-compose`.\n\n```bash\n# shut down but keep persisted Jenkins data in the docker volume\ndocker-compose down\n\n# start Jenkins\ndocker-compose up -d\n```\n\nShut down and delete all Jenkins data.\n\n    docker-compose down --rmi local --volumes\n\n### Upgrade Jenkins and plugins\n\nit is suggested to perform a plugin refresh instead of upgrading the plugins.\nAs Jenkins plugins get developed new plugin dependencies get added and removed.\nThis bloat over time can cause Jenkins instances to have a large amount of\nplugins installed which are not used.  To keep your Jenkins instance lean with\nplugins a full plugin refresh is suggested.\n\nLearn more by reading the [upgrade documentation](scripts/upgrade/README.md).\n\n### Build an RPM package\n\n    ./gradlew clean buildRpm\n\n### Build a docker image\n\n**Why not the official image?** Using this docker image has a few advantages\nover the official image:\n\n- This image is minimal (~292MB) vs official (~809MB).  Based on Alpine Linux.\n- Dependencies during the build when including plugins can be cached in\n  Artifactory or Nexus\n- More options are exposed while some defaults are sane for running within\n  Docker.\n\n**Build it:**\n\n    ./gradlew clean buildTar\n    docker build -t jenkins .\n\nAlternatively, if you're building from a downstream project:\n\n    docker build -f jenkins-bootstrap-shared/Dockerfile -t jenkins .\n\nThe following environment variables can be overridden in the docker container\nif using docker-compose.\n\n| VARIABLE                  | TYPE | DESCRIPTION |\n| ------------------------- | ---- | ----------- |\n| `JENKINS_HOME`            | Path | Jenkins configuration location. Default is `/var/lib/jenkins`. |\n| `JENKINS_PORT`            | int  | set the http listening port. -1 to disable, Default is 8080 |\n| `JENKINS_DEBUG_LEVEL`     | int  | set the level of debug msgs (1-9). Default is 5 (INFO level) |\n| `JENKINS_HANDLER_MAX`     | int  | set the max no of worker threads to allow. Default is 100 |\n| `JENKINS_HANDLER_IDLE`    | int  | set the max no of idle worker threads to allow. Default is 20 |\n| `JENKINS_ARGS`            | Str  | Any additional args available to `jenkins.war` |\n\nDocker environment variables related to HTTPS.  Note: HTTPS will only be\navailable if a keystore is defined.  All other variables are disabled without\nit.\n\n| VARIABLE                               | TYPE | DESCRIPTION |\n| -------------------------------------- | ---- | ----------- |\n| `JENKINS_KEYSTORE`                     | Path | the location of the SSL KeyStore file. |\n| `JENKINS_HTTPS_PORT`                   | int  | set the https listening port. -1 to disable, Default is 8443. |\n| `JENKINS_HTTPS_KEYSTORE_PASSWORD`      | Str  | the password for the SSL KeyStore file. Default is changeit |\n| `JENKINS_HTTPS_KEYSTORE_PASSWORD_FILE` | Path | Same as password but in a file. |\n\n\u003e Note: if you plan to start the docker container from an existing Jenkins home,\n\u003e you must first set permissions to the uid/gid of the jenkins user inside the\n\u003e container.  Example:\n\u003e\n\u003e     $ docker run -it --rm jenkinsbootstrapshared_jenkins id\n\u003e     uid=100(jenkins) gid=65533(nogroup) groups=65533(nogroup)\n\u003e\n\u003e     $ chown -R 100:65533 /path/to/jenkins/home\n\n### Other Usage\n\nFor service control and other usage see [`USAGE`](USAGE.md).\n\n# License\n\n* [ASL 2](LICENSE)\n* [3rd party licenses](3rd_party)\n\n[ci-img]: https://travis-ci.org/samrocketman/jenkins-bootstrap-shared.svg?branch=main\n[ci-link]: https://travis-ci.org/samrocketman/jenkins-bootstrap-shared\n[docker]: https://www.docker.com/\n[jbj]: https://github.com/samrocketman/jenkins-bootstrap-jervis\n[vagrant]: https://www.vagrantup.com/\n[vbox]: https://www.virtualbox.org/\n","funding_links":[],"categories":["Groovy"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamrocketman%2Fjenkins-bootstrap-shared","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamrocketman%2Fjenkins-bootstrap-shared","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamrocketman%2Fjenkins-bootstrap-shared/lists"}