platform: 'darwin'

inputs:
  - name: kubernikus.builds
    path: gopath/src/github.com/sapcc/kubernikus
outputs:
  - name: binaries

run:
  path: /bin/sh
  args:
    - -exc
    - |
      export BINARIES=$(pwd -P)/binaries
      export GOPATH=$PWD/gopath

      cd gopath/src/github.com/sapcc/kubernikus

      make bin/darwin/kubernikusctl
      make bin/linux/kubernikusctl
      make bin/windows/kubernikusctl.exe
      upx bin/*/*
      SHA=$(git rev-parse HEAD)
      echo $SHA > $BINARIES/commitish
      echo "1.0.0+$SHA" > $BINARIES/tag

      cp bin/darwin/kubernikusctl $BINARIES/kubernikusctl_darwin_amd64
      cp bin/linux/kubernikusctl $BINARIES/kubernikusctl_linux_amd64
      cp bin/windows/kubernikusctl.exe $BINARIES/kubernikusctl_windows_amd64.exe

params:

platform: 'linux'

image_resource:
  type: docker-image
  source:
    repository: golang
    tag: 1.11.5-alpine3.8
inputs:
  - name: kubernikus.builds
    path: gopath/src/github.com/sapcc/kubernikus
outputs:
  - name: binaries

run:
  path: /bin/sh
  args:
    - -exc
    - |
      export BINARIES=$(pwd -P)/binaries
      export GOPATH=$PWD/gopath
      export CGO_ENABLED=0

      cd gopath/src/github.com/sapcc/kubernikus
      apk add --no-cache upx make git

      make bin/darwin/kubernikusctl
      make bin/linux/kubernikusctl
      make bin/windows/kubernikusctl.exe
      upx bin/*/*
      SHA=$(git rev-parse HEAD)
      echo $SHA > $BINARIES/commitish
      echo "1.0.0+$SHA" > $BINARIES/tag

      cp bin/darwin/kubernikusctl $BINARIES/kubernikusctl_darwin_amd64
      cp bin/linux/kubernikusctl $BINARIES/kubernikusctl_linux_amd64
      cp bin/windows/kubernikusctl.exe $BINARIES/kubernikusctl_windows_amd64.exe

params:

Update cli task to build on linux workers
Update cli task to build on linux workers
