From 7e2b1593f24d28e9cfb32ed1bcde44aa7c57abdc Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Sat, 19 May 2018 08:56:39 +0000 Subject: [PATCH 1/9] Add Dockerfile, small fix --- Dockerfile.windows | 37 +++++++++++++++++++++++++++++++++++++ cf-deploy-kubernetes.sh | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.windows diff --git a/Dockerfile.windows b/Dockerfile.windows new file mode 100644 index 0000000..96b9e3d --- /dev/null +++ b/Dockerfile.windows @@ -0,0 +1,37 @@ +FROM microsoft/windowsservercore:1709 + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +RUN $url = 'https://cygwin.com/setup-x86_64.exe'; \ + Write-Host ('Downloading {0} ...' -f $url); \ + Invoke-WebRequest -Uri $url -OutFile 'C:/setup-x86_64.exe'; \ + \ + Write-Host 'Installing ...'; \ + New-Item -ItemType directory -Path 'C:/tmp'; \ + Start-Process "C:/setup-x86_64.exe" -NoNewWindow -Wait -PassThru -ArgumentList @('-q','-v','-n','-B','-R','C:/cygwin64','-l','C:/tmp','-s','http://mirror.pkill.info/cygwin/','-P','default,curl,openssl'); \ + \ + Write-Host 'Removing ...'; \ + Remove-Item -Path 'C:/tmp' -Force -Recurse -ErrorAction Ignore; \ + \ + Write-Host 'Verifying install ...'; \ + Start-Process "C:/cygwin64/bin/cygcheck.exe" -NoNewWindow -Wait -PassThru -ArgumentList @('-c'); \ + \ + Write-Host 'Complete.'; + +RUN $ACL=Get-Acl -Path 'C:\'; \ + Set-Acl -Path 'C:\cygwin64\' -AclObject $ACL + +SHELL ["C:/cygwin64/bin/sh", "-l", "-c"] +WORKDIR C:/cygwin64/bin + +RUN ["curl -o kubectl.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/windows/amd64/kubectl.exe"] +RUN ["curl -o kubectl1.6.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/windows/amd64/kubectl.exe"] +RUN ["chmod +x /usr/bin/kubectl.exe /usr/bin/kubectl1.6.exe"] + +COPY cf-deploy-kubernetes.sh ../cf-deploy-kubernetes +COPY template.sh ../template.sh + +RUN 'sed -i "s/\r$//" C:/cygwin64/cf-deploy-kubernetes' +RUN 'sed -i "s/\r$//" C:/cygwin64/template.sh' + +ENTRYPOINT ["C:/cygwin64/bin/sh", "-l", "-c"] \ No newline at end of file diff --git a/cf-deploy-kubernetes.sh b/cf-deploy-kubernetes.sh index 188bd0a..97652fd 100755 --- a/cf-deploy-kubernetes.sh +++ b/cf-deploy-kubernetes.sh @@ -47,7 +47,7 @@ if (( "$SERVER_VERSION" <= "16" )); then mv /usr/local/bin/kubectl1.6 /usr/local DEPLOYMENT_FILE=${deployment_file}-$(date '+%y-%m-%d_%H-%M-%S').yml -$(dirname $0)/template.sh "$deployment_file" > "$DEPLOYMENT_FILE" || fatal "Failed to apply deployment template on $deployment_file" +/template.sh "$deployment_file" > "$DEPLOYMENT_FILE" || fatal "Failed to apply deployment template on $deployment_file" echo "---> Kubernetes objects to deploy in $deployment_file :" From 0a8c3096049f3ecb125177911a375b6bbee597e5 Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Wed, 18 Jul 2018 09:47:54 +0000 Subject: [PATCH 2/9] Windows Server v1803 --- Dockerfile.windows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 96b9e3d..6034ed9 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore:1709 +FROM microsoft/windowsservercore:1803 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] From c1c99d54671ba241d689e0e5347686410d6ad168 Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Sat, 8 Sep 2018 09:49:10 +0300 Subject: [PATCH 3/9] Fix timeout flag, version check --- cf-deploy-kubernetes.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cf-deploy-kubernetes.sh b/cf-deploy-kubernetes.sh index 97652fd..e6d80d7 100755 --- a/cf-deploy-kubernetes.sh +++ b/cf-deploy-kubernetes.sh @@ -8,7 +8,7 @@ fatal() { readonly KUBECTL_ACTION=${KUBECTL_ACTION:-apply} [[ $KUBECTL_ACTION =~ ^(apply|create|replace)$ ]] || fatal "KUBECTL_ACTION should be one of apply|create|replace " -deployment_file=${1:-deployment.yml} +deployment_file=${1:-C:/codefresh/volume/cf-generated/deployment.yml} : ${KUBERNETES_NAMESPACE:=default} : ${KUBERNETES_DEPLOYMENT_TIMEOUT:=120} @@ -38,9 +38,9 @@ else fi #check the cluster version and decide which version of kubectl to use: -SERVER_VERSION=$(kubectl version --short=true | grep -i server | cut -c18-20 | tr -d .) +SERVER_VERSION=$(kubectl version --short=true --context "${KUBECONTEXT}" | grep -i server | cut -c18-20 | tr -d .) -if (( "$SERVER_VERSION" <= "16" )); then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi +if (( "$SERVER_VERSION" <= "16" )); then mv /usr/local/bin/kubectl1.6 /usr/local/bin/kubectl; fi 2>/dev/null [ ! -f "${deployment_file}" ] && echo "Couldn't find $deployment_file file at $(pwd)" && exit 1; @@ -66,5 +66,5 @@ kubectl --context "${KUBECONTEXT}" --namespace "${KUBERNETES_NAMESPACE}" $KUBECT if [ -n "$DEPLOYMENT_NAME" ]; then echo "---> Waiting for a successful deployment/${DEPLOYMENT_NAME} status to namespace ${KUBERNETES_NAMESPACE} ..." - timeout -s SIGTERM -t $KUBERNETES_DEPLOYMENT_TIMEOUT kubectl --context "${KUBECONTEXT}" --namespace "${KUBERNETES_NAMESPACE}" rollout status deployment/"${DEPLOYMENT_NAME}" || fatal "Deployment Failed" + timeout -s SIGTERM $KUBERNETES_DEPLOYMENT_TIMEOUT kubectl --context "${KUBECONTEXT}" --namespace "${KUBERNETES_NAMESPACE}" rollout status deployment/"${DEPLOYMENT_NAME}" || fatal "Deployment Failed" fi From 006f35f3f2933c5ddb6bd6e1bacf48c50c74027d Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Tue, 11 Dec 2018 13:47:30 +0000 Subject: [PATCH 4/9] Windows 1809 --- Dockerfile.windows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 6034ed9..dfd1453 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore:1803 +FROM mcr.microsoft.com/windows/servercore:1809 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] From 53b693a5036cb93650d0bcbb89de612d05597474 Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Thu, 6 Jun 2019 07:36:25 +0000 Subject: [PATCH 5/9] Add LABEL --- Dockerfile.windows | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.windows b/Dockerfile.windows index dfd1453..cc0907c 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -34,4 +34,6 @@ COPY template.sh ../template.sh RUN 'sed -i "s/\r$//" C:/cygwin64/cf-deploy-kubernetes' RUN 'sed -i "s/\r$//" C:/cygwin64/template.sh' +LABEL owner=codefresh.io + ENTRYPOINT ["C:/cygwin64/bin/sh", "-l", "-c"] \ No newline at end of file From 512f76f594b66814161c23db610963f25ccbb8f9 Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Wed, 6 May 2020 16:10:51 +0300 Subject: [PATCH 6/9] Update Dockerfile for windows --- Dockerfile.windows | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index cc0907c..2e1d294 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/windows/servercore:1809 +FROM mcr.microsoft.com/windows/servercore:1909 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] @@ -8,7 +8,7 @@ RUN $url = 'https://cygwin.com/setup-x86_64.exe'; \ \ Write-Host 'Installing ...'; \ New-Item -ItemType directory -Path 'C:/tmp'; \ - Start-Process "C:/setup-x86_64.exe" -NoNewWindow -Wait -PassThru -ArgumentList @('-q','-v','-n','-B','-R','C:/cygwin64','-l','C:/tmp','-s','http://mirror.pkill.info/cygwin/','-P','default,curl,openssl'); \ + Start-Process "C:/setup-x86_64.exe" -NoNewWindow -Wait -PassThru -ArgumentList @('-q','-v','-n','-B','-R','C:/cygwin64','-l','C:/tmp','-s','https://mirrors.sonic.net/cygwin/','-P', 'default,curl,openssl'); \ \ Write-Host 'Removing ...'; \ Remove-Item -Path 'C:/tmp' -Force -Recurse -ErrorAction Ignore; \ @@ -24,9 +24,9 @@ RUN $ACL=Get-Acl -Path 'C:\'; \ SHELL ["C:/cygwin64/bin/sh", "-l", "-c"] WORKDIR C:/cygwin64/bin -RUN ["curl -o kubectl.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/windows/amd64/kubectl.exe"] -RUN ["curl -o kubectl1.6.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/windows/amd64/kubectl.exe"] -RUN ["chmod +x /usr/bin/kubectl.exe /usr/bin/kubectl1.6.exe"] +RUN 'curl -o /usr/bin/kubectl.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/windows/amd64/kubectl.exe' +RUN 'curl -o /usr/bin/kubectl1.6.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/windows/amd64/kubectl.exe' +RUN 'chmod +x /usr/bin/kubectl.exe /usr/bin/kubectl1.6.exe' COPY cf-deploy-kubernetes.sh ../cf-deploy-kubernetes COPY template.sh ../template.sh From 59c7de2706da85e8657a796a5cc8962b6fc5fa25 Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Sat, 16 Jan 2021 10:31:24 +0300 Subject: [PATCH 7/9] Use pinned working version of cygwin --- Dockerfile.windows | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 2e1d294..9ce3408 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -8,7 +8,7 @@ RUN $url = 'https://cygwin.com/setup-x86_64.exe'; \ \ Write-Host 'Installing ...'; \ New-Item -ItemType directory -Path 'C:/tmp'; \ - Start-Process "C:/setup-x86_64.exe" -NoNewWindow -Wait -PassThru -ArgumentList @('-q','-v','-n','-B','-R','C:/cygwin64','-l','C:/tmp','-s','https://mirrors.sonic.net/cygwin/','-P', 'default,curl,openssl'); \ + Start-Process "C:/setup-x86_64.exe" -NoNewWindow -Wait -PassThru -ArgumentList @('-q','-v','-n','-B','-R','C:/cygwin64','-l','C:/tmp','-s','http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2019/03/06/161558','-X','-P', 'default,curl,openssl'); \ \ Write-Host 'Removing ...'; \ Remove-Item -Path 'C:/tmp' -Force -Recurse -ErrorAction Ignore; \ From 7a277a2b03fe1cdda33a320c90183db7858b0e24 Mon Sep 17 00:00:00 2001 From: alex-codefresh Date: Sat, 16 Jan 2021 10:43:59 +0300 Subject: [PATCH 8/9] Use OS_RELEASE build arg --- Dockerfile.windows | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 9ce3408..3b49040 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -1,4 +1,6 @@ -FROM mcr.microsoft.com/windows/servercore:1909 +ARG OS_RELEASE + +FROM mcr.microsoft.com/windows/servercore:${OS_RELEASE} SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] From 56d3f2ee0c17b9aa96a1aa29dce6d7d3a0881cdd Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 22 Feb 2022 13:50:04 +0300 Subject: [PATCH 9/9] upd kubectl --- Dockerfile.windows | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 3b49040..cb8bab2 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -26,9 +26,8 @@ RUN $ACL=Get-Acl -Path 'C:\'; \ SHELL ["C:/cygwin64/bin/sh", "-l", "-c"] WORKDIR C:/cygwin64/bin -RUN 'curl -o /usr/bin/kubectl.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/windows/amd64/kubectl.exe' -RUN 'curl -o /usr/bin/kubectl1.6.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.6.0/bin/windows/amd64/kubectl.exe' -RUN 'chmod +x /usr/bin/kubectl.exe /usr/bin/kubectl1.6.exe' +RUN 'curl -o /usr/bin/kubectl.exe -L https://storage.googleapis.com/kubernetes-release/release/v1.22.0/bin/windows/amd64/kubectl.exe' +RUN 'chmod +x /usr/bin/kubectl.exe' COPY cf-deploy-kubernetes.sh ../cf-deploy-kubernetes COPY template.sh ../template.sh