Hi, on our production openshift cluster we don't have internet access, so i 
want to disable Jenkins to check for updates.
 
I made this file in init.groovy.d/disable-all-update-sites.groovy

/*
   This script completely disables all update sites in Jenkins, invalidates 
plugin
   upgrade data, and deletes the cached update data.
   Additionally, it sets a system property to disable all update sites.
*/
import hudson.model.UpdateSite
import jenkins.model.Jenkins
import hudson.util.PersistedList;




script_file = getClass().protectionDomain.codeSource.location.path

def j = Jenkins.instance
PersistedList<UpdateSite> sites = j.getUpdateCenter().getSites();
for(UpdateSite site : sites ) {
    site.neverUpdate = true
    try {
        site.data = null
        site.dataLastReadFromFile = -1
    } catch(Exception e) {}
    site.dataTimestamp = 0
    new File(j.getRootDir(), "updates/${site.id}.json").delete()
    println(" -> removed update-site: " + site.getUrl())
  sites.remove(site)
}
j.getUpdateCenter().save()
j.save()


//https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties
System.setProperty('hudson.model.UpdateCenter.never', 'true')


But still there is an update check during startup of Jenkins. In de 
configuration all update sites are gone, but after the execution of this 
script in the sysout there is this this message:

INFO: The attempt #1 to do the action check updates server failed with an 
allowed exception:
java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at 
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at 
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at 
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:189)
at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1766)
at hudson.util.Retrier.start(Retrier.java:62)
at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1737)
at 
jenkins.model.DownloadSettings$DailyCheck.execute(DownloadSettings.java:130)
at hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:101)
at java.lang.Thread.run(Thread.java:748)
Aug 28, 2019 4:06:03 PM hudson.util.Retrier start
INFO: Calling the listener of the allowed exception 'connect timed out' at 
the attempt #1 to do the action check updates server
Aug 28, 2019 4:06:03 PM hudson.util.Retrier start
INFO: Attempted the action check updates server for 1 time(s) with no 
success
Aug 28, 2019 4:06:03 PM hudson.PluginManager doCheckUpdatesServer
SEVERE: Error checking update sites for 1 attempt(s). Last exception was: 
SocketTimeoutException: connect timed out


How can i prevent that?

Thanks,

Jeroen

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d896a48e-f1a9-491b-b3aa-c3a2a8705236%40googlegroups.com.

Reply via email to