From 66e16943bcbdc8c33d562c90e02ab1376e06aa5d Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Thu, 30 Jun 2022 22:04:13 +0200 Subject: [PATCH] Disabled Proxy by default and added custom proxy option to jeninsfile --- CT-Build/Alpine.Jenkinsfile | 4 ++++ CT-Build/Alpine.yaml | 6 +++--- CT-Build/Debian.Jenkinsfile | 4 ++++ CT-Build/Debian.yaml | 4 ++-- Scripts/UpdateIMGBuildFile-CacheAndRepo.sh | 18 ++++++++++++------ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/CT-Build/Alpine.Jenkinsfile b/CT-Build/Alpine.Jenkinsfile index b522b35..de636ce 100644 --- a/CT-Build/Alpine.Jenkinsfile +++ b/CT-Build/Alpine.Jenkinsfile @@ -8,6 +8,7 @@ pipeline { booleanParam description: 'Only build specified variant', name: 'OneRun' string defaultValue: 'VariantName', description: 'Variant for OneBuild', name: 'OneRunVariant' booleanParam description: 'Disable of Proxy server for package repos ', name: 'DisProxy' + string defaultValue: '192.168.200.11', description: 'Proxy server for packages, (when enabled) ', name: 'ProxyServer' } options { skipDefaultCheckout() @@ -31,6 +32,9 @@ pipeline { script{ if (env.DisProxy == 'true') { sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -d''' + } else { + env.ProxyServer = ProxyServer + sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -e $ProxyServer''' } } } diff --git a/CT-Build/Alpine.yaml b/CT-Build/Alpine.yaml index dfd81f4..deaf88f 100644 --- a/CT-Build/Alpine.yaml +++ b/CT-Build/Alpine.yaml @@ -7,7 +7,7 @@ source: same_as: 3.12 keyserver: keys.openpgp.org #InitDownloadREPO - url: http://192.168.200.11/alpine/ + url: http://dl-4.alpinelinux.org/alpine/ keys: # 0482D84022F52DF1C4E7CD43293ACD0907D9495A - |- @@ -581,8 +581,8 @@ packages: - name: /etc/apk/repositories url: |- #StartREPOS - http://192.168.200.11/alpine/v{{ image.release }}/main - http://192.168.200.11/alpine/v{{ image.release }}/community + http://dl-4.alpinelinux.org/alpine/v{{ image.release }}/main + http://dl-4.alpinelinux.org/alpine/v{{ image.release }}/community #EndREPOS {% if image.variant == "ddns" %}@TestingEdge http://dl-4.alpinelinux.org/alpine/edge/testing{% endif %} {% if image.variant == "vouchproxy" %}@CommunityEdge http://dl-4.alpinelinux.org/alpine/edge/community{% endif %} diff --git a/CT-Build/Debian.Jenkinsfile b/CT-Build/Debian.Jenkinsfile index 16e7b35..b140a2b 100644 --- a/CT-Build/Debian.Jenkinsfile +++ b/CT-Build/Debian.Jenkinsfile @@ -8,6 +8,7 @@ pipeline { booleanParam description: 'Only build specified variant', name: 'OneRun' string defaultValue: 'VariantName', description: 'Variant for OneBuild', name: 'OneRunVariant' booleanParam description: 'Disable of Proxy server for package repos ', name: 'DisProxy' + string defaultValue: '192.168.200.11', description: 'Proxy server for packages, (when enabled) ', name: 'ProxyServer' } options { skipDefaultCheckout() @@ -31,6 +32,9 @@ pipeline { script{ if (env.DisProxy == 'true') { sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -d''' + } else { + env.ProxyServer = ProxyServer + sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -e $ProxyServer''' } } } diff --git a/CT-Build/Debian.yaml b/CT-Build/Debian.yaml index aea0bdd..d75afa9 100644 --- a/CT-Build/Debian.yaml +++ b/CT-Build/Debian.yaml @@ -5,7 +5,7 @@ image: source: downloader: debootstrap #InitDownloadREPO - url: http://192.168.200.11/deb.debian.org/debian + url: http://deb.debian.org/debian keyserver: keys.openpgp.org keys: # 0x126C0D24BD8A2942CC7DF8AC7638D0442B90D010 @@ -1412,7 +1412,7 @@ actions: echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/01Recommends echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/01Suggests #ProxyCacheSetting - echo 'Acquire::http::Proxy "http://192.168.200.11:80";' > /etc/apt/apt.conf.d/01prox + echo '#CacheServer not set' > /etc/apt/apt.conf.d/01prox - trigger: post-packages action: |- #!/bin/sh diff --git a/Scripts/UpdateIMGBuildFile-CacheAndRepo.sh b/Scripts/UpdateIMGBuildFile-CacheAndRepo.sh index a2f7698..0f4d649 100644 --- a/Scripts/UpdateIMGBuildFile-CacheAndRepo.sh +++ b/Scripts/UpdateIMGBuildFile-CacheAndRepo.sh @@ -1,22 +1,28 @@ #!/bin/bash #Allow for external definiton of status of cache StatusFlag=$1 +ProxyFlag=$2 #UserSettings ThisScriptConfigured=no UseCache=no -#Cache enable (using apt-cacher-NG) -CacheAlpineRepo="http://192.168.200.11/alpine/" -CacheDebianCache="http://192.168.200.11:80" -CacheDebianCore="http://192.168.200.11/deb.debian.org/debian" - +#Cache server if flag not set enable (using apt-cacher-NG) +ConfigProxyServer="192.168.200.11" #Cache enable (using Official MirrorServers) DefaultAlpineRepo="http://dl-4.alpinelinux.org/alpine/" DefaultDebianCore="http://deb.debian.org/debian" ###Do not Edit underneath### +if [ -n "$ProxyFlag" ]; then + UseServer="$ProxyFlag" +else + UseServer="$ConfigProxyServer" +fi +CacheAlpineRepo="http://$UseServer/alpine/" +CacheDebianCache="http://$UseServer:80" +CacheDebianCore="http://$UseServer/deb.debian.org/debian" #Check if using StatusFlag if not chek if scipt is configured if [ -n "$StatusFlag" ]; then @@ -33,7 +39,7 @@ fi #Check if using Cache if [ $UseCache = yes ]; then - echo "Using cache server" + echo "Using cache server $UseServer" AlpineRepo=$CacheAlpineRepo DebianCache='Acquire::http::Proxy "'$CacheDebianCache'";' DebianCore=$CacheDebianCore