mirror of https://github.com/portainer/portainer
				
				
				
			Merge windows buildx to develop (#4796)
* feat(build): introducing buildx for Windows * feat(build): re-ordered USER * feat(build): Fixed Typo * feat(build): fixed typo Co-authored-by: ssbkang <skan070@gmail.com>pull/4801/head
							parent
							
								
									a71e71f481
								
							
						
					
					
						commit
						afbd353808
					
				| 
						 | 
					@ -1,24 +0,0 @@
 | 
				
			||||||
param (
 | 
					 | 
				
			||||||
  [string]$platform,
 | 
					 | 
				
			||||||
  [string]$arch
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$ErrorActionPreference = "Stop";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$binary = "portainer.exe"
 | 
					 | 
				
			||||||
$go_path = "$($(Get-ITEM -Path env:AGENT_TEMPDIRECTORY).Value)\go"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Set-Item env:GOPATH "$go_path"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
New-Item -Name dist -Path "." -ItemType Directory -Force | Out-Null
 | 
					 | 
				
			||||||
New-Item -Name portainer -Path "$go_path\src\github.com\portainer" -ItemType Directory -Force | Out-Null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copy-Item -Path "api" -Destination "$go_path\src\github.com\portainer\portainer\api" -Recurse -Force
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Set-Location -Path "api\cmd\portainer"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
go get -t -d -v ./...
 | 
					 | 
				
			||||||
## go build -v
 | 
					 | 
				
			||||||
& cmd /c 'go build -v 2>&1'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Copy-Item -Path "portainer.exe" -Destination "$($env:BUILD_SOURCESDIRECTORY)\dist\portainer.exe" -Force 
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,8 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PLATFORM=$1
 | 
				
			||||||
 | 
					ARCH=$2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export GOPATH="/tmp/go"
 | 
					export GOPATH="/tmp/go"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
binary="portainer"
 | 
					binary="portainer"
 | 
				
			||||||
| 
						 | 
					@ -10,6 +15,10 @@ cp -R api ${GOPATH}/src/github.com/portainer/portainer/api
 | 
				
			||||||
cd 'api/cmd/portainer'
 | 
					cd 'api/cmd/portainer'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
go get -t -d -v ./...
 | 
					go get -t -d -v ./...
 | 
				
			||||||
GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags '-s'
 | 
					GOOS=${PLATFORM} GOARCH=${ARCH} CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags '-s'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mv "$BUILD_SOURCESDIRECTORY/api/cmd/portainer/$binary" "$BUILD_SOURCESDIRECTORY/dist/portainer"
 | 
					if [ "${PLATFORM}" == 'windows' ]; then
 | 
				
			||||||
 | 
					  mv "$BUILD_SOURCESDIRECTORY/api/cmd/portainer/${binary}.exe" "$BUILD_SOURCESDIRECTORY/dist/portainer.exe"
 | 
				
			||||||
 | 
					else  
 | 
				
			||||||
 | 
					  mv "$BUILD_SOURCESDIRECTORY/api/cmd/portainer/$binary" "$BUILD_SOURCESDIRECTORY/dist/portainer"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,15 +0,0 @@
 | 
				
			||||||
param (
 | 
					 | 
				
			||||||
  [string]$docker_version
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$ErrorActionPreference = "Stop";
 | 
					 | 
				
			||||||
$ProgressPreference = "SilentlyContinue";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
New-Item -Path "docker-binary" -ItemType Directory | Out-Null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$download_folder = "docker-binary"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Invoke-WebRequest -O "$($download_folder)/docker-binaries.zip" "https://dockermsft.azureedge.net/dockercontainer/docker-$($docker_version).zip"
 | 
					 | 
				
			||||||
Expand-Archive -Path "$($download_folder)/docker-binaries.zip" -DestinationPath "$($download_folder)"
 | 
					 | 
				
			||||||
Move-Item -Path "$($download_folder)/docker/docker.exe" -Destination "dist"
 | 
					 | 
				
			||||||
Move-Item -Path "$($download_folder)/docker/*.dll" -Destination "dist"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -10,9 +10,10 @@ rm -rf "${DOWNLOAD_FOLDER}"
 | 
				
			||||||
mkdir -pv "${DOWNLOAD_FOLDER}"
 | 
					mkdir -pv "${DOWNLOAD_FOLDER}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "${PLATFORM}" == 'win' ]; then
 | 
					if [ "${PLATFORM}" == 'win' ]; then
 | 
				
			||||||
  wget -O "${DOWNLOAD_FOLDER}/docker-binaries.zip" "https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.zip"
 | 
					  wget -O "${DOWNLOAD_FOLDER}/docker-binaries.zip" "https://dockermsft.azureedge.net/dockercontainer/docker-${DOCKER_VERSION}.zip"
 | 
				
			||||||
  unzip "${DOWNLOAD_FOLDER}/docker-binaries.zip" -d "${DOWNLOAD_FOLDER}"
 | 
					  unzip "${DOWNLOAD_FOLDER}/docker-binaries.zip" -d "${DOWNLOAD_FOLDER}"
 | 
				
			||||||
  mv "${DOWNLOAD_FOLDER}/docker/docker.exe" dist/
 | 
					  mv "${DOWNLOAD_FOLDER}/docker/docker.exe" dist/
 | 
				
			||||||
 | 
					  mv ${DOWNLOAD_FOLDER}/docker/*.dll dist/
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  wget -O "${DOWNLOAD_FOLDER}/docker-binaries.tgz" "https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz"
 | 
					  wget -O "${DOWNLOAD_FOLDER}/docker-binaries.tgz" "https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz"
 | 
				
			||||||
  tar -xf "${DOWNLOAD_FOLDER}/docker-binaries.tgz" -C "${DOWNLOAD_FOLDER}"
 | 
					  tar -xf "${DOWNLOAD_FOLDER}/docker-binaries.tgz" -C "${DOWNLOAD_FOLDER}"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +0,0 @@
 | 
				
			||||||
param (
 | 
					 | 
				
			||||||
  [string]$docker_compose_version
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$ErrorActionPreference = "Stop";
 | 
					 | 
				
			||||||
$ProgressPreference = "SilentlyContinue";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Invoke-WebRequest -O "dist/docker-compose.exe" "https://github.com/docker/compose/releases/download/$($docker_compose_version)/docker-compose-Windows-x86_64.exe"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,9 @@ if [ "${PLATFORM}" == 'linux' ] && [ "${ARCH}" == 'amd64' ]; then
 | 
				
			||||||
elif [ "${PLATFORM}" == 'mac' ]; then
 | 
					elif [ "${PLATFORM}" == 'mac' ]; then
 | 
				
			||||||
  wget -O "dist/docker-compose" "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Darwin-x86_64"
 | 
					  wget -O "dist/docker-compose" "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Darwin-x86_64"
 | 
				
			||||||
  chmod +x "dist/docker-compose"
 | 
					  chmod +x "dist/docker-compose"
 | 
				
			||||||
 | 
					elif [ "${PLATFORM}" == 'win' ]; then
 | 
				
			||||||
 | 
					  wget -O "dist/docker-compose.exe" "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Windows-x86_64.exe"
 | 
				
			||||||
 | 
					  chmod +x "dist/docker-compose.exe"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +0,0 @@
 | 
				
			||||||
param (
 | 
					 | 
				
			||||||
  [string]$kompose_version
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$ErrorActionPreference = "Stop";
 | 
					 | 
				
			||||||
$ProgressPreference = "SilentlyContinue";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Invoke-WebRequest -O "dist/kompose.exe" "https://github.com/kubernetes/kompose/releases/download/$($kompose_version)/kompose-windows-amd64.exe"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,12 @@ PLATFORM=$1
 | 
				
			||||||
ARCH=$2
 | 
					ARCH=$2
 | 
				
			||||||
KOMPOSE_VERSION=$3
 | 
					KOMPOSE_VERSION=$3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wget -O "dist/kompose" "https://github.com/kubernetes/kompose/releases/download/${KOMPOSE_VERSION}/kompose-${PLATFORM}-${ARCH}"
 | 
					if [ "${PLATFORM}" == 'linux' ]; then
 | 
				
			||||||
chmod +x "dist/kompose"
 | 
					  wget -O "dist/kompose" "https://github.com/kubernetes/kompose/releases/download/${KOMPOSE_VERSION}/kompose-${PLATFORM}-${ARCH}"
 | 
				
			||||||
 | 
					  chmod +x "dist/kompose"
 | 
				
			||||||
 | 
					elif [ "${PLATFORM}" == 'windows' ]; then
 | 
				
			||||||
 | 
					  wget -O "dist/kompose.exe" "https://github.com/kubernetes/kompose/releases/download/${KOMPOSE_VERSION}/kompose-windows-amd64.exe"
 | 
				
			||||||
 | 
					  chmod +x "dist/kompose.exe"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +0,0 @@
 | 
				
			||||||
param (
 | 
					 | 
				
			||||||
  [string]$kubectl_version
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$ErrorActionPreference = "Stop";
 | 
					 | 
				
			||||||
$ProgressPreference = "SilentlyContinue";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Invoke-WebRequest -O "dist/kubectl.exe" "https://storage.googleapis.com/kubernetes-release/release/$($kubectl_version)/bin/windows/amd64/kubectl.exe"
 | 
					 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,12 @@ PLATFORM=$1
 | 
				
			||||||
ARCH=$2
 | 
					ARCH=$2
 | 
				
			||||||
KUBECTL_VERSION=$3
 | 
					KUBECTL_VERSION=$3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wget -O "dist/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${PLATFORM}/${ARCH}/kubectl"
 | 
					 | 
				
			||||||
chmod +x "dist/kubectl"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "${PLATFORM}" == 'linux' ]; then
 | 
				
			||||||
 | 
					  wget -O "dist/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${PLATFORM}/${ARCH}/kubectl"
 | 
				
			||||||
 | 
					  chmod +x "dist/kubectl"
 | 
				
			||||||
 | 
					elif [ "${PLATFORM}" == 'windows' ]; then
 | 
				
			||||||
 | 
					  wget -O "dist/kubectl.exe" "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/windows/amd64/kubectl.exe"
 | 
				
			||||||
 | 
					  chmod +x "dist/kubectl.exe"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,24 @@
 | 
				
			||||||
 | 
					ARG OSVERSION
 | 
				
			||||||
 | 
					FROM --platform=linux/amd64 gcr.io/k8s-staging-e2e-test-images/windows-servercore-cache:1.0-linux-amd64-${OSVERSION} as core
 | 
				
			||||||
 | 
					FROM --platform=linux/amd64 alpine:3.13.0 as downloader
 | 
				
			||||||
 | 
					ENV GIT_VERSION 2.30.0
 | 
				
			||||||
 | 
					ENV GIT_PATCH_VERSION 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN mkdir mingit/ \
 | 
				
			||||||
 | 
					&& wget https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.$GIT_PATCH_VERSION/MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip \
 | 
				
			||||||
 | 
					&& unzip MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip -d mingit/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM mcr.microsoft.com/windows/nanoserver:${OSVERSION}
 | 
				
			||||||
 | 
					ENV PATH "C:\mingit\cmd;C:\Windows\system32;C:\Windows;"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPY --from=downloader /mingit mingit/
 | 
				
			||||||
 | 
					COPY --from=core /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					USER ContainerAdministrator
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPY dist /
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXPOSE 9000
 | 
				
			||||||
 | 
					EXPOSE 8000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENTRYPOINT ["/portainer.exe"]
 | 
				
			||||||
| 
						 | 
					@ -1,27 +0,0 @@
 | 
				
			||||||
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as core
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ENV GIT_VERSION 2.30.0
 | 
					 | 
				
			||||||
ENV GIT_PATCH_VERSION 2
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN powershell -Command $ErrorActionPreference = 'Stop' ; \
 | 
					 | 
				
			||||||
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
 | 
					 | 
				
			||||||
    Invoke-WebRequest $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}.{1}-busybox-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) -OutFile 'mingit.zip' -UseBasicParsing ; \
 | 
					 | 
				
			||||||
    Expand-Archive mingit.zip -DestinationPath c:\mingit
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM mcr.microsoft.com/windows/nanoserver:1809-amd64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
USER ContainerAdministrator
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
COPY --from=core /windows/system32/netapi32.dll /windows/system32/netapi32.dll
 | 
					 | 
				
			||||||
COPY --from=core /mingit /mingit
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
COPY dist /
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN setx /M path "C:\mingit\cmd;%path%"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
WORKDIR /
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
EXPOSE 9000
 | 
					 | 
				
			||||||
EXPOSE 8000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ENTRYPOINT ["/portainer.exe"]
 | 
					 | 
				
			||||||
							
								
								
									
										103
									
								
								gruntfile.js
								
								
								
								
							
							
						
						
									
										103
									
								
								gruntfile.js
								
								
								
								
							| 
						 | 
					@ -165,11 +165,7 @@ function shell_build_binary(p, a) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shell_build_binary_azuredevops(p, a) {
 | 
					function shell_build_binary_azuredevops(p, a) {
 | 
				
			||||||
  if (p === 'linux') {
 | 
					  return 'build/build_binary_azuredevops.sh ' + p + ' ' + a + ';';
 | 
				
			||||||
    return 'build/build_binary_azuredevops.sh ' + p + ' ' + a + ';';
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    return 'powershell -Command ".\\build\\build_binary_azuredevops.ps1 -platform ' + p + ' -arch ' + a + '"';
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shell_run_container() {
 | 
					function shell_run_container() {
 | 
				
			||||||
| 
						 | 
					@ -195,83 +191,52 @@ function shell_download_docker_binary(p, a) {
 | 
				
			||||||
  var ip = ps[p] === undefined ? p : ps[p];
 | 
					  var ip = ps[p] === undefined ? p : ps[p];
 | 
				
			||||||
  var ia = as[a] === undefined ? a : as[a];
 | 
					  var ia = as[a] === undefined ? a : as[a];
 | 
				
			||||||
  var binaryVersion = p === 'windows' ? '<%= binaries.dockerWindowsVersion %>' : '<%= binaries.dockerLinuxVersion %>';
 | 
					  var binaryVersion = p === 'windows' ? '<%= binaries.dockerWindowsVersion %>' : '<%= binaries.dockerLinuxVersion %>';
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  if (p === 'linux' || p === 'mac') {
 | 
					  return [
 | 
				
			||||||
    return ['if [ -f dist/docker ]; then', 'echo "docker binary exists";', 'else', 'build/download_docker_binary.sh ' + ip + ' ' + ia + ' ' + binaryVersion + ';', 'fi'].join(' ');
 | 
					    'if [ -f dist/docker ] || [ -f dist/docker.exe ]; then',
 | 
				
			||||||
  } else {
 | 
					    'echo "docker binary exists";',
 | 
				
			||||||
    return [
 | 
					    'else',
 | 
				
			||||||
      'powershell -Command "& {if (Test-Path -Path "dist/docker.exe") {',
 | 
					    'build/download_docker_binary.sh ' + ip + ' ' + ia + ' ' + binaryVersion + ';',
 | 
				
			||||||
      'Write-Host "Skipping download, Docker binary exists"',
 | 
					    'fi',
 | 
				
			||||||
      'return',
 | 
					  ].join(' ');
 | 
				
			||||||
      '} else {',
 | 
					 | 
				
			||||||
      '& ".\\build\\download_docker_binary.ps1" -docker_version ' + binaryVersion + '',
 | 
					 | 
				
			||||||
      '}}"',
 | 
					 | 
				
			||||||
    ].join(' ');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shell_download_docker_compose_binary(p, a) {
 | 
					function shell_download_docker_compose_binary(p, a) {
 | 
				
			||||||
  console.log('request docker compose for ' + p + ':' + a);
 | 
					 | 
				
			||||||
  var ps = { windows: 'win', darwin: 'mac' };
 | 
					  var ps = { windows: 'win', darwin: 'mac' };
 | 
				
			||||||
  var as = { arm: 'armhf', arm64: 'aarch64' };
 | 
					  var as = { arm: 'armhf', arm64: 'aarch64' };
 | 
				
			||||||
  var ip = ps[p] || p;
 | 
					  var ip = ps[p] || p;
 | 
				
			||||||
  var ia = as[a] || a;
 | 
					  var ia = as[a] || a;
 | 
				
			||||||
  console.log('download docker compose for ' + ip + ':' + ia);
 | 
					  var binaryVersion = p === 'windows' ? '<%= binaries.dockerWindowsComposeVersion %>' : '<%= binaries.dockerLinuxComposeVersion %>';
 | 
				
			||||||
  var linuxBinaryVersion = '<%= binaries.dockerLinuxComposeVersion %>';
 | 
					  
 | 
				
			||||||
  var windowsBinaryVersion = '<%= binaries.dockerWindowsComposeVersion %>';
 | 
					  return [
 | 
				
			||||||
  console.log('download docker compose versions; Linux: ' + linuxBinaryVersion + ' Windows: ' + windowsBinaryVersion);
 | 
					    'if [ -f dist/docker-compose ] || [ -f dist/docker-compose.exe ]; then',
 | 
				
			||||||
 | 
					    'echo "Docker Compose binary exists";',
 | 
				
			||||||
  if (ip === 'linux' || ip === 'mac') {
 | 
					    'else',
 | 
				
			||||||
    return [
 | 
					    'build/download_docker_compose_binary.sh ' + ip + ' ' + ia + ' ' + binaryVersion + ';',
 | 
				
			||||||
      'if [ -f dist/docker-compose ]; then',
 | 
					    'fi',
 | 
				
			||||||
      'echo "Docker Compose binary exists";',
 | 
					  ].join(' ');
 | 
				
			||||||
      'else',
 | 
					 | 
				
			||||||
      'build/download_docker_compose_binary.sh ' + ip + ' ' + ia + ' ' + linuxBinaryVersion + ';',
 | 
					 | 
				
			||||||
      'fi',
 | 
					 | 
				
			||||||
    ].join(' ');
 | 
					 | 
				
			||||||
  } else if (ip === 'win') {
 | 
					 | 
				
			||||||
    return [
 | 
					 | 
				
			||||||
      'powershell -Command "& {if (Test-Path -Path "dist/docker-compose.exe") {',
 | 
					 | 
				
			||||||
      'Write-Host "Skipping download, Docker Compose binary exists"',
 | 
					 | 
				
			||||||
      'return',
 | 
					 | 
				
			||||||
      '} else {',
 | 
					 | 
				
			||||||
      '& ".\\build\\download_docker_compose_binary.ps1" -docker_compose_version ' + windowsBinaryVersion + '',
 | 
					 | 
				
			||||||
      '}}"',
 | 
					 | 
				
			||||||
    ].join(' ');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  console.log('docker compose is downloaded');
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shell_download_kompose_binary(p, a) {
 | 
					function shell_download_kompose_binary(p, a) {
 | 
				
			||||||
  var binaryVersion = '<%= binaries.komposeVersion %>';
 | 
					  var binaryVersion = '<%= binaries.komposeVersion %>';
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  if (p === 'linux' || p === 'darwin') {
 | 
					  return [
 | 
				
			||||||
    return ['if [ -f dist/kompose ]; then', 'echo "kompose binary exists";', 'else', 'build/download_kompose_binary.sh ' + p + ' ' + a + ' ' + binaryVersion + ';', 'fi'].join(' ');
 | 
					    'if [ -f dist/kompose ] || [ -f dist/kompose.exe ]; then',
 | 
				
			||||||
  } else {
 | 
					    'echo "kompose binary exists";',
 | 
				
			||||||
    return [
 | 
					    'else',
 | 
				
			||||||
      'powershell -Command "& {if (Test-Path -Path "dist/kompose.exe") {',
 | 
					    'build/download_kompose_binary.sh ' + p + ' ' + a + ' ' + binaryVersion + ';',
 | 
				
			||||||
      'Write-Host "Skipping download, Kompose binary exists"',
 | 
					    'fi',
 | 
				
			||||||
      'return',
 | 
					  ].join(' ');
 | 
				
			||||||
      '} else {',
 | 
					 | 
				
			||||||
      '& ".\\build\\download_kompose_binary.ps1" -kompose_version ' + binaryVersion + '',
 | 
					 | 
				
			||||||
      '}}"',
 | 
					 | 
				
			||||||
    ].join(' ');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function shell_download_kubectl_binary(p, a) {
 | 
					function shell_download_kubectl_binary(p, a) {
 | 
				
			||||||
  var binaryVersion = '<%= binaries.kubectlVersion %>';
 | 
					  var binaryVersion = '<%= binaries.kubectlVersion %>';
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  if (p === 'linux' || p === 'darwin') {
 | 
					  return [
 | 
				
			||||||
    return ['if [ -f dist/kubectl ]; then', 'echo "kubectl binary exists";', 'else', 'build/download_kubectl_binary.sh ' + p + ' ' + a + ' ' + binaryVersion + ';', 'fi'].join(' ');
 | 
					    'if [ -f dist/kubectl ] || [ -f dist/kubectl.exe ]; then',
 | 
				
			||||||
  } else {
 | 
					    'echo "kubectl binary exists";',
 | 
				
			||||||
    return [
 | 
					    'else',
 | 
				
			||||||
      'powershell -Command "& {if (Test-Path -Path "dist/kubectl.exe") {',
 | 
					    'build/download_kubectl_binary.sh ' + p + ' ' + a + ' ' + binaryVersion + ';',
 | 
				
			||||||
      'Write-Host "Skipping download, Kubectl binary exists"',
 | 
					    'fi',
 | 
				
			||||||
      'return',
 | 
					  ].join(' ');
 | 
				
			||||||
      '} else {',
 | 
					 | 
				
			||||||
      '& ".\\build\\download_kubectl_binary.ps1" -kubectl_version ' + binaryVersion + '',
 | 
					 | 
				
			||||||
      '}}"',
 | 
					 | 
				
			||||||
    ].join(' ');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue