fix(build-system): revert appveyor integration

* Revert "fix(build-system): fix local build system after appveyor introduction (#2528)"

This reverts commit 79c24ced96.

* Revert "feat(build-system): add support for AppVeyor CI (#2449)"

This reverts commit 65979709e9.
pull/2527/head^2
Anthony Lapenna 6 years ago committed by GitHub
parent 79c24ced96
commit f5dc663879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,17 +0,0 @@
param (
[string]$platform,
[string]$arch
)
$ErrorActionPreference = "Stop";
$binary = "portainer.exe"
$project_path = (Get-ITEM -Path env:APPVEYOR_BUILD_FOLDER).Value
New-Item -Name dist -Path "$project_path" -ItemType Directory | Out-Null
Set-Location -Path "$project_path\api\cmd\portainer"
C:\go\bin\go.exe get -t -d -v ./...
C:\go\bin\go.exe build -v
Move-Item -Path "$($binary)" -Destination "..\..\..\dist"

@ -1,9 +0,0 @@
binary="portainer"
mkdir -p dist
cd 'api/cmd/portainer'
go get -t -d -v ./...
GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags '-s'
mv "${binary}" "../../../dist/portainer"

@ -1,24 +0,0 @@
param (
[string]$platform,
[string]$arch
)
$ErrorActionPreference = "Stop";
$binary = "portainer.exe"
$project_path = (Get-ITEM -Path env:APPVEYOR_BUILD_FOLDER).Value
Set-Item env:GOPATH "$project_path\api"
New-Item -Name dist -Path "$project_path" -ItemType Directory | Out-Null
New-Item -Name portainer -Path "$project_path\api\src\github.com\" -ItemType Directory | Out-Null
Copy-Item -Path "$project_path\api" -Destination "$project_path\api\src\github.com\portainer" -Recurse -Force -ErrorAction:SilentlyContinue
Rename-Item -Path "$project_path\api\src\github.com\portainer\api" -NewName "portainer" -ErrorAction:SilentlyContinue
Set-Location -Path "$project_path\api\cmd\portainer"
C:\go\bin\go.exe get -t -d -v ./...
C:\go\bin\go.exe build -v
Move-Item -Path "$project_path\api\cmd\portainer\$($binary)" -Destination "$project_path\dist"

@ -1,14 +0,0 @@
export GOPATH="$APPVEYOR_BUILD_FOLDER/api"
binary="portainer"
mkdir -p dist
mkdir -p api/src/github.com/portainer/
cp -R api/ api/src/github.com/portainer/portainer/
cd 'api/cmd/portainer'
go get -t -d -v ./...
GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags '-s'
mv "$APPVEYOR_BUILD_FOLDER/api/cmd/portainer/$binary" "$APPVEYOR_BUILD_FOLDER/dist/portainer"

@ -0,0 +1,10 @@
#!/usr/bin/env sh
binary="portainer-$1-$2"
mkdir -p dist
docker run --rm -tv "$(pwd)/api:/src" -e BUILD_GOOS="$1" -e BUILD_GOARCH="$2" portainer/golang-builder:cross-platform /src/cmd/portainer
mv "api/cmd/portainer/$binary" dist/
#sha256sum "dist/$binary" > portainer-checksum.txt

@ -1,28 +0,0 @@
IMAGE="$1"
ARCH="$2"
DOCKER_USER="$3"
DOCKER_PASS="$4"
APPVEYOR_REPO_BRANCH="$5"
APPVEYOR_PULL_REQUEST_NUMBER="$6"
if [ "${APPVEYOR_PULL_REQUEST_NUMBER}" ]; then
tag="pr${APPVEYOR_PULL_REQUEST_NUMBER}-$IMAGE-$ARCH"
manifest="pr${APPVEYOR_PULL_REQUEST_NUMBER}"
else
tag="${APPVEYOR_REPO_BRANCH}-$IMAGE-$ARCH"
manifest="${APPVEYOR_REPO_BRANCH}"
fi
docker build -t "portainer/portainer:$tag" -f build/linux/Dockerfile .
docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}"
docker push "portainer/portainer:$tag"
if [ "${2}" == 'amd64' ] ; then
docker -D manifest create "portainer/portainer:$manifest" \
"portainer/portainer:$manifest-linux-amd64" \
"portainer/portainer:$manifest-windows-amd64" \
"portainer/portainer:$manifest-windows1709-amd64" \
"portainer/portainer:$manifest-windows1803-amd64"
docker manifest push "portainer/portainer:$manifest"
fi

@ -1,36 +0,0 @@
$ErrorActionPreference = "Stop";
$pull_request_number = $ENV:APPVEYOR_PULL_REQUEST_NUMBER
$branch_name = $ENV:APPVEYOR_REPO_BRANCH
$os = (Get-Item ENV:IMAGE).Value
$arch = (Get-Item ENV:ARCH).Value
if ($pull_request_number) {
$tag = "pr$($pull_request_number)-$($os)-$($arch)"
$tag_1709 = "pr$($pull_request_number)-$($os)1709-$($arch)"
$tag_1803 = "pr$($pull_request_number)-$($os)1803-$($arch)"
} else {
$tag = "$($branch_name)-$($os)-$($arch)"
$tag_1709 = "$($branch_name)-$($os)1709-$($arch)"
$tag_1803 = "$($branch_name)-$($os)1803-$($arch)"
}
docker build `
-t portainer/portainer:$tag `
-f build\windows2016\nanoserver\Dockerfile .
docker login `
-u "$((Get-Item ENV:DOCKER_USER).Value)" `
-p "$((Get-Item ENV:DOCKER_PASS).Value)"
docker push portainer/portainer:$tag
rebase-docker-image `
portainer/portainer:$tag `
-t portainer/portainer:$tag_1709 `
-b microsoft/nanoserver:1709
rebase-docker-image `
portainer/portainer:$tag `
-t portainer/portainer:$tag_1803 `
-b microsoft/nanoserver:1803

@ -1,13 +0,0 @@
param (
[string]$docker_version
)
$ErrorActionPreference = "Stop";
New-Item -Path "docker-binary" -ItemType Directory | Out-Null
$download_folder = "docker-binary"
Invoke-WebRequest -O "$($download_folder)/docker-binaries.zip" "https://download.docker.com/win/static/stable/x86_64/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"

@ -19,4 +19,4 @@ else
mv "${DOWNLOAD_FOLDER}/docker/docker" dist/
fi
exit 0
exit 0

@ -1,45 +0,0 @@
IMAGE="$1"
ARCH="$2"
PORTAINER_VERSION="$3"
DOCKER_USER="$4"
DOCKER_PASS="$5"
mkdir -pv portainer
cp -r dist/* portainer
tar cvpfz "portainer-$PORTAINER_VERSION-$IMAGE-$ARCH.tar.gz" portainer
sha256sum --tag "portainer-$PORTAINER_VERSION-$IMAGE-$ARCH.tar.gz" > "portainer-$PORTAINER_VERSION-$IMAGE-$ARCH-checksum.txt"
tag="$IMAGE-$ARCH"
docker build -t "portainer/portainer:$IMAGE-$ARCH-$PORTAINER_VERSION" -f build/linux/Dockerfile .
docker tag "portainer/portainer:$IMAGE-$ARCH-$PORTAINER_VERSION" "portainer/portainer:$IMAGE-$ARCH"
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
docker push "portainer/portainer:$IMAGE-$ARCH-$PORTAINER_VERSION"
docker push "portainer/portainer:$IMAGE-$ARCH"
if [ "${2}" == 's390x' ] ; then
docker -D manifest create "portainer/portainer:latest" \
"portainer/portainer:linux-amd64" \
"portainer/portainer:linux-arm" \
"portainer/portainer:linux-arm64" \
"portainer/portainer:linux-ppc64le" \
"portainer/portainer:linux-s390x" \
"portainer/portainer:windows-amd64" \
"portainer/portainer:windows1709-amd64" \
"portainer/portainer:windows1803-amd64"
docker manifest push "portainer/portainer:latest"
docker -D manifest create "portainer/portainer:${PORTAINER_VERSION}" \
"portainer/portainer:linux-amd64-${PORTAINER_VERSION}" \
"portainer/portainer:linux-arm-${PORTAINER_VERSION}" \
"portainer/portainer:linux-arm64-${PORTAINER_VERSION}" \
"portainer/portainer:linux-ppc64le-${PORTAINER_VERSION}" \
"portainer/portainer:linux-s390x-${PORTAINER_VERSION}" \
"portainer/portainer:windows-amd64-${PORTAINER_VERSION}" \
"portainer/portainer:windows1709-amd64-${PORTAINER_VERSION}" \
"portainer/portainer:windows1803-amd64-${PORTAINER_VERSION}"
docker manifest push "portainer/portainer:${PORTAINER_VERSION}"
fi

@ -1,41 +0,0 @@
$ErrorActionPreference = "Stop";
$binary = "portainer-$((Get-Item ENV:PORTAINER_VERSION).Value)-$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value).tar.gz"
New-Item -Path portainer -ItemType Directory | Out-Null
Copy-Item -Path dist\* -Destination portainer -Recurse
tar cvpfz $binary portainer
(Get-FileHash $binary).Hash > "portainer-$((Get-Item ENV:PORTAINER_VERSION).Value)-$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value)-checksum.txt"
docker build `
-t portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value)-$((Get-Item ENV:PORTAINER_VERSION).Value) `
-f build\windows2016\nanoserver\Dockerfile .
docker tag portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value)-$((Get-Item ENV:PORTAINER_VERSION).Value) portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value)
docker login `
-u "$((Get-Item ENV:DOCKER_USER).Value)" `
-p "$((Get-Item ENV:DOCKER_PASS).Value)"
docker push portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value)-$((Get-Item ENV:PORTAINER_VERSION).Value)
docker push portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value)
rebase-docker-image `
portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value) `
-t portainer/portainer:$((Get-Item ENV:IMAGE).Value)1709-$((Get-Item ENV:ARCH).Value)-$((Get-Item ENV:PORTAINER_VERSION).Value) `
-b microsoft/nanoserver:1709
rebase-docker-image `
portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value) `
-t portainer/portainer:$((Get-Item ENV:IMAGE).Value)1709-$((Get-Item ENV:ARCH).Value) `
-b microsoft/nanoserver:1709
rebase-docker-image `
portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value) `
-t portainer/portainer:$((Get-Item ENV:IMAGE).Value)1803-$((Get-Item ENV:ARCH).Value)-$((Get-Item ENV:PORTAINER_VERSION).Value) `
-b microsoft/nanoserver:1803
rebase-docker-image `
portainer/portainer:$((Get-Item ENV:IMAGE).Value)-$((Get-Item ENV:ARCH).Value) `
-t portainer/portainer:$((Get-Item ENV:IMAGE).Value)1803-$((Get-Item ENV:ARCH).Value) `
-b microsoft/nanoserver:1803

@ -51,10 +51,6 @@ module.exports = function(grunt) {
grunt.task.run(['config:prod', 'clean:all', 'shell:buildBinary:' + p + ':' + a, 'shell:downloadDockerBinary:' + p + ':' + a, 'before-copy', 'copy:assets', 'after-copy']);
});
grunt.task.registerTask('appveyorbuild', 'appveyorbuild:<platform>:<arch>', function(p, a) {
grunt.task.run(['config:prod', 'clean:all', 'shell:buildBinaryOnAppveyor:' + p + ':' + a, 'shell:downloadDockerBinary:' + p + ':' + a, 'before-copy', 'copy:assets', 'after-copy']);
});
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('run-dev', ['build', 'shell:run:' + arch, 'watch:build']);
grunt.registerTask('clear', ['clean:app']);
@ -264,49 +260,16 @@ gruntfile_cfg.replace = {
};
function shell_buildBinary(p, a) {
var binfile = 'portainer-' + p + '-' + a;
if (p === 'linux') {
return [
'if [ -f ' + (binfile) + ' ]; then',
'echo "Portainer binary exists";',
'else',
'build/build_binary.sh ' + p + ' ' + a + ';',
'fi'
].join(' ');
} else {
return [
'powershell -Command "& {if (Get-Item -Path ' + binfile + '.exe -ErrorAction:SilentlyContinue) {',
'Write-Host "Portainer binary exists"',
'} else {',
'& ".\\build\\build_binary.ps1" -platform ' + p + ' -arch ' + a + '',
'}}"'
].join(' ');
}
}
function shell_buildBinaryOnAppveyor(p, a) {
var binfile = 'portainer-' + p + '-' + a;
if (p === 'linux') {
return [
'if [ -f ' + (binfile) + ' ]; then',
'echo "Portainer binary exists";',
'else',
'build/build_binary_appveyor.sh ' + p + ' ' + a + ';',
'fi'
].join(' ');
} else {
return [
'powershell -Command "& {if (Get-Item -Path ' + binfile + '.exe -ErrorAction:SilentlyContinue) {',
'Write-Host "Portainer binary exists"',
'} else {',
'& ".\\build\\build_binary_appveyor.ps1" -platform ' + p + ' -arch ' + a + '',
'}}"'
].join(' ');
}
var binfile = 'dist/portainer-' + p + '-' + a;
return [
'if [ -f ' + ((p === 'windows') ? binfile + '.exe' : binfile) + ' ]; then',
'echo "Portainer binary exists";',
'else',
'build/build_in_container.sh ' + p + ' ' + a + ';',
'fi'
].join(' ');
}
function shell_run(arch) {
return [
'docker rm -f portainer',
@ -320,28 +283,17 @@ function shell_downloadDockerBinary(p, a) {
var ip = ((ps[p] === undefined) ? p : ps[p]);
var ia = ((as[a] === undefined) ? a : as[a]);
var binaryVersion = ((p === 'windows' ? '<%= shippedDockerVersionWindows %>' : '<%= shippedDockerVersion %>'));
if (p === 'linux') {
return [
'if [ -f dist/docker ]; then',
'echo "Docker binary exists";',
'else',
'build/download_docker_binary.sh ' + ip + ' ' + ia + ' ' + binaryVersion + ';',
'fi'
].join(' ');
} else {
return [
'powershell -Command "& {if (Get-Item -Path dist/docker.exe -ErrorAction:SilentlyContinue) {',
'Write-Host "Docker binary exists"',
'} else {',
'& ".\\build\\download_docker_binary.ps1" -docker_version ' + binaryVersion + '',
'}}"'
].join(' ');
}
return [
'if [ -f ' + ((p === 'windows') ? 'dist/docker.exe' : 'dist/docker') + ' ]; then',
'echo "Docker binary exists";',
'else',
'build/download_docker_binary.sh ' + ip + ' ' + ia + ' ' + binaryVersion + ';',
'fi'
].join(' ');
}
gruntfile_cfg.shell = {
buildBinary: { command: shell_buildBinary },
buildBinaryOnAppveyor: { command: shell_buildBinaryOnAppveyor },
run: { command: shell_run },
downloadDockerBinary: { command: shell_downloadDockerBinary }
};

Loading…
Cancel
Save