Skip to content

Instantly share code, notes, and snippets.

@cccaternberg
Last active November 19, 2020 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cccaternberg/2978fa4e6d38ac7a296c63e8bf62570a to your computer and use it in GitHub Desktop.
Save cccaternberg/2978fa4e6d38ac7a296c63e8bf62570a to your computer and use it in GitHub Desktop.
Artifactory/Jenkins
see https://jfrog.com/knowledge-base/how-to-configure-artifactory-as-an-internal-jenkins-update-site/
* Create a remote repo named Jenkins-update
* Create a local repo named jenkins-update-center
* Get the update-center.json from repo Jenkins-update to local and modify the URL from 'http://updates.jenkins-ci.org/' to my own URL 'https://artifacts.xxx.com/artifactory/Jenkins-update/' in update-center.json, then put update-center.json into local repo.
```
#!/bin/sh
curl -L -o /tmp/update-center.json http://localhost:8081/artifactory/Jenkins-update-cache/update-center.json
sed -i 's#http://updates.jenkins-ci.org/#https://artifacts.xxx.com/artifactory/Jenkins-update/#g' /tmp/update-center.json
curl -L -uuser:pass -T /tmp/update-center.json "http://localhost:8081/artifactory/jenkins-update-center/update-center.json"
```
Change the default update site from 'http://updates.jenkins-ci.org/' to 'https://artifacts.xxx.com/artifactory/jenkins-update-center/update-center.json' in Jenkins
@NetAppBlueDevil
Copy link

This isn't really enough. The update-center.json also includes a hash signing that will be out of sync if you just change the URL content in the file. You need to re-sign the file in the same manner and also then configure your jenkins servers to trust that signing certificate (if not public CA based - that is a default update on the underlying JVM cacerts).

I have used this method for a static mirroring of the Jenkins update site I have made for my environment. You would need to do this process on a cron schedule to update the json file probably daily or so since it is a dynamic index file of the update site. This would not be just a one time upload to a local repo like this. I would probably recommend to extend the above to include a virtual repo to include the local and remote as described able and point Jenkins at the virtual repo where it would find the json file and then be able to request the packages as well.

See here for the reference on this point https://github.com/ikedam/backend-update-center2/wiki/How-to-create-your-own-Jenkins-Update-Center

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment