File scripts.obscpio of Package dapper

07070100000000000081ed00000000000000000000000167a5f31000000785000000000000000000000000000000000000000e00000000scripts/build#!/bin/sh
set -ex

cd "$(dirname $0)"/..

. ./scripts/version

mkdir -p bin

if [ "$CROSS" = 1 ]; then
    CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -ldflags "-X main.VERSION=$VERSION"  -o ./bin/dapper-Darwin-x86_64 main.go
    CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Windows-x86_64.exe main.go
    CGO_ENABLED=0 GOARCH=arm64 GOOS=darwin go build -ldflags "-X main.VERSION=$VERSION"  -o ./bin/dapper-Darwin-arm64 main.go
    CGO_ENABLED=0 GOARCH=arm64 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Linux-arm64 main.go
    CGO_ENABLED=0 GOARCH=ppc64le go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Linux-ppc64le main.go
    CGO_ENABLED=0 GOARCH=s390x go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Linux-s390x main.go
    CGO_ENABLED=0 GOARCH=arm GOARM=6 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Linux-arm main.go
    CGO_ENABLED=0 GOARCH=arm GOARM=6 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Linux-armv6l main.go
    CGO_ENABLED=0 GOARCH=arm GOARM=7 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION" -o ./bin/dapper-Linux-armv7l main.go
    CGO_ENABLED=0 GOARCH=amd64 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION -extldflags '-static -s'" -o ./bin/dapper-Linux-x86_64 main.go
    cp ./bin/dapper-Linux-arm64 ./bin/dapper-Linux-aarch64

    cp ./bin/dapper-$(uname -s)-$(uname -m) ./bin/dapper
    echo Built ./bin/dapper-$(uname -s)-$(uname -m)
else
    CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo -ldflags "-X main.VERSION=$VERSION -extldflags '-static -s'" -o ./bin/dapper main.go
    echo Built ./bin/dapper
fi
07070100000001000081ed00000000000000000000000167a5f3100000004a000000000000000000000000000000000000000b00000000scripts/ci#!/bin/sh
set -ex

cd "$(dirname $0)"

./validate
./build
./test
./package07070100000002000081ed00000000000000000000000167a5f31000000053000000000000000000000000000000000000001700000000scripts/copy-latest.sh#!/bin/sh
gsutil -m cp -r dist/artifacts/* gs://releases.rancher.com/dapper/latest
07070100000003000081ed00000000000000000000000167a5f31000000092000000000000000000000000000000000000001800000000scripts/copy-release.sh#!/bin/sh
VERSION=$(./bin/dapper-Linux-x86_64 -v | awk '{print $3}')
gsutil -m cp -r dist/artifacts/* gs://releases.rancher.com/dapper/${VERSION}
07070100000004000081ed00000000000000000000000167a5f31000000121000000000000000000000000000000000000001500000000scripts/docker-image#!/bin/sh
set -ex

cd "$(dirname $0)"/..

if [ -x bin/dapper ]; then
    ./scripts/build
fi

DOCKER_VERSION=$(grep -e '^FROM docker:' Dockerfile | sed 's/FROM docker://')

docker build -t rancher/dapper:${DOCKER_VERSION} .
mkdir -p dist
echo rancher/dapper:${DOCKER_VERSION} > dist/images
07070100000005000081ed00000000000000000000000167a5f310000000b9000000000000000000000000000000000000000e00000000scripts/entry#!/bin/sh
set -ex

mkdir -p bin dist
if [ -e ./scripts/"$1" ]; then
    ./scripts/"$@"
else
    exec "$@"
fi

if [ "$DAPPER_UID" -ne "-1" ]; then
  chown -R $DAPPER_UID:$DAPPER_GID .
fi07070100000006000081ed00000000000000000000000167a5f31000000361000000000000000000000000000000000000001a00000000scripts/multi-arch-images#!/bin/sh
set -e

cd "$(dirname $0)"/..

. ./scripts/version

REPO=${REPO:-rancher}

echo '#!/bin/sh' >push.sh
chmod +x push.sh

docker manifest inspect docker:18.09 | jq -r '.manifests[] | "\(.digest) \(.platform.architecture)"' | while read HASH ARCH; do
    BIN_ARCH=${ARCH}
    if [ "${ARCH}" = amd64 ];then
        BIN_ARCH=x86_64
    fi
    cat > Dockerfile.gen << EOF
FROM docker@${HASH}
COPY bin/dapper-Linux-${BIN_ARCH} /usr/local/bin/dapper
EOF
    docker build -f Dockerfile.gen -t ${REPO}/dapper:${VERSION}-linux-${ARCH} .
    echo "docker push ${REPO}/dapper:${VERSION}-linux-${ARCH}" >> push.sh
done

echo manifest-tool push from-args --platforms linux/arm,linux/arm64,linux/amd64 --template ${REPO}/dapper:${VERSION}-OS-ARCH --target ${REPO}/dapper:${VERSION} >> push.sh
echo '#######' push.sh
cat ./push.sh
echo '#######' push.sh
echo run ./push.sh
07070100000007000081ed00000000000000000000000167a5f3100000005b000000000000000000000000000000000000001000000000scripts/package#!/bin/sh

cd "$(dirname $0)"/..

mkdir -p dist/artifacts
cp -r bin/dapper* dist/artifacts
07070100000008000081ed00000000000000000000000167a5f31000000033000000000000000000000000000000000000001000000000scripts/release#!/bin/sh

cd "$(dirname $0)"

./ci
./docker-image
07070100000009000081ed00000000000000000000000167a5f31000000038000000000000000000000000000000000000000d00000000scripts/test#!/bin/sh
set -ex

cd "$(dirname $0)"/..

go test ./...
0707010000000a000081ed00000000000000000000000167a5f31000000101000000000000000000000000000000000000001100000000scripts/validate#!/bin/bash
set -e

cd $(dirname $0)/..

if ! command -v golangci-lint; then	echo Running: go fmt
    echo Skipping validation: no golangci-lint available	test -z "$(go fmt ./... | tee /dev/stderr)"
    exit
fi

echo Running: golangci-lint
golangci-lint run0707010000000b000081ed00000000000000000000000167a5f3100000011f000000000000000000000000000000000000001000000000scripts/version#!/bin/bash -ex

if [ -n "$VERSION" ]; then
	return
fi

VERSION=$(git tag -l --contains HEAD | head -n 1)
if [ -z "$VERSION" ]; then
    VERSION=$(git rev-parse --short HEAD)
    if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
        VERSION="$VERSION-dirty"
    fi
fi
0707010000000c000081a400000000000000000000000167a5f3100000023a000000000000000000000000000000000000001a00000000scripts/windows/build.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

Invoke-Expression -Command "$PSScriptRoot\version.ps1"

$DIR_PATH = Split-Path -Parent $MyInvocation.MyCommand.Definition
$SRC_PATH = (Resolve-Path "$DIR_PATH\..\..").Path
cd $SRC_PATH

$null = New-Item -Type Directory -Path bin -ErrorAction Ignore
$env:GOARCH=$env:ARCH
$env:GOOS='windows'
$env:CGO_ENABLED=0
$LINKFLAGS = ('-X main.VERSION={0} -s -w -extldflags "-static"' -f $env:VERSION)
go build -ldflags $LINKFLAGS -o .\bin\dapper.exe main.go0707010000000d000081a400000000000000000000000167a5f3100000011a000000000000000000000000000000000000001700000000scripts/windows/ci.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

Invoke-Expression -Command "$PSScriptRoot\build.ps1"
Invoke-Expression -Command "$PSScriptRoot\test.ps1"
Invoke-Expression -Command "$PSScriptRoot\package.ps1"0707010000000e000081a400000000000000000000000167a5f31000000452000000000000000000000000000000000000002100000000scripts/windows/docker-image.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

$DIR_PATH = Split-Path -Parent $MyInvocation.MyCommand.Definition
$SRC_PATH = (Resolve-Path "$DIR_PATH\..\..").Path
cd $SRC_PATH

if (-not (Test-Path "bin\dapper")) {
    Invoke-Expression -Command "$DIR_PATH\build.ps1"
}

# Get release id as image tag suffix
$HOST_RELEASE_ID = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -ErrorAction Ignore).ReleaseId
$RELEASE_ID = $env:RELEASE_ID
if (-not $RELEASE_ID) {
    $RELEASE_ID = $HOST_RELEASE_ID
}

$IMAGE = ('rancher/dapper:windows-{0}' -f $RELEASE_ID)
if ($RELEASE_ID -eq $HOST_RELEASE_ID) {
    docker build `
        --build-arg SERVERCORE_VERSION=$RELEASE_ID `
        -t $IMAGE `
        -f Dockerfile-windows .
} else {
    docker build `
        --isolation hyperv `
        --build-arg SERVERCORE_VERSION=$RELEASE_ID `
        -t $IMAGE `
        -f Dockerfile-windows .
}
$null = New-Item -Type Directory -Path dsit -ErrorAction Ignore
$IMAGE | Out-File -Encoding ascii -Force -FilePath dsit\images0707010000000f000081a400000000000000000000000167a5f3100000016a000000000000000000000000000000000000001a00000000scripts/windows/entry.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

$SCRIPT_PATH = ("{0}\{1}.ps1" -f $PSScriptRoot, $Args[0])
if (Test-Path $SCRIPT_PATH -ErrorAction Ignore) {
    Invoke-Expression -Command $SCRIPT_PATH
    exit
}

Start-Process -Wait -FilePath $Args[0] -ArgumentList $Args[1..$Args.Length]07070100000010000081a400000000000000000000000167a5f3100000018e000000000000000000000000000000000000001c00000000scripts/windows/package.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

$DIR_PATH = Split-Path -Parent $MyInvocation.MyCommand.Definition
$SRC_PATH = (Resolve-Path "$DIR_PATH\..\..").Path
cd $SRC_PATH

$null = New-Item -Type Directory -Path dsit\artifacts -ErrorAction Ignore
$null = Copy-Item -Force -Path bin\dapper* -Destination dsit\artifacts
07070100000011000081a400000000000000000000000167a5f310000000e9000000000000000000000000000000000000001c00000000scripts/windows/release.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

Invoke-Expression -Command "$PSScriptRoot\ci.ps1"
Invoke-Expression -Command "$PSScriptRoot\docker-image.ps1"
07070100000012000081a400000000000000000000000167a5f31000000088000000000000000000000000000000000000001900000000scripts/windows/test.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

go test ./...07070100000013000081a400000000000000000000000167a5f31000000276000000000000000000000000000000000000001c00000000scripts/windows/version.ps1#Requires -Version 5.0
$ErrorActionPreference = "Stop"

trap {
    Write-Host -ForegroundColor DarkRed "$_"

    exit 1
}

$DIRTY = ""
if ("$(git status --porcelain --untracked-files=no)") {
    $DIRTY = "-dirty"
}

$COMMIT = (git rev-parse --short HEAD)
$GIT_TAG = $env:DRONE_TAG
if (-not $GIT_TAG) {
    $GIT_TAG = $(git tag -l --contains HEAD | Select-Object -First 1)
}

$VERSION = "${COMMIT}${DIRTY}"
if ((-not $DIRTY) -and ($GIT_TAG)) {
    $VERSION = "${GIT_TAG}"
}
$env:VERSION = $VERSION

$ARCH = $env:ARCH
if (-not $ARCH) {
    $ARCH = "amd64"
}
$env:ARCH = $ARCH

Write-Host "ARCH: $ARCH"
Write-Host "VERSION: $VERSION"07070100000014000041ed00000000000000000000000167a5f31000000000000000000000000000000000000000000000001000000000scripts/windows07070100000015000041ed00000000000000000000000167a5f31000000000000000000000000000000000000000000000000800000000scripts07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!
openSUSE Build Service is sponsored by