2017-05-08 00:01:04 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# only execute this script as part of the pipeline.
|
2019-04-04 19:18:28 +00:00
|
|
|
# [ -z "$CI" ] && echo "missing ci environment variable" && exit 2
|
2017-05-08 00:01:04 +00:00
|
|
|
|
|
|
|
# only execute the script when github token exists.
|
2019-04-04 19:18:28 +00:00
|
|
|
# [ -z "$SSH_KEY" ] && echo "missing ssh key" && exit 3
|
2017-05-08 00:01:04 +00:00
|
|
|
|
2017-05-08 01:03:38 +00:00
|
|
|
# write the ssh key.
|
2019-04-04 19:18:28 +00:00
|
|
|
# mkdir /root/.ssh
|
|
|
|
# echo -n "$SSH_KEY" > /root/.ssh/id_rsa
|
|
|
|
# chmod 600 /root/.ssh/id_rsa
|
2017-05-08 00:01:04 +00:00
|
|
|
|
2017-05-08 01:21:54 +00:00
|
|
|
# add github.com to our known hosts.
|
2019-04-04 19:18:28 +00:00
|
|
|
# touch /root/.ssh/known_hosts
|
|
|
|
# chmod 600 /root/.ssh/known_hosts
|
|
|
|
# ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts 2> /dev/null
|
2017-05-08 01:03:38 +00:00
|
|
|
|
2017-05-08 00:01:04 +00:00
|
|
|
# clone the extras project.
|
2017-05-08 00:14:53 +00:00
|
|
|
set -e
|
|
|
|
set -x
|
2019-04-04 19:18:28 +00:00
|
|
|
# git clone git@github.com:drone/drone-enterprise.git extras
|
2017-05-08 00:01:04 +00:00
|
|
|
|
|
|
|
# build a static binary with the build number and extra features.
|
2019-04-04 19:18:28 +00:00
|
|
|
go build -ldflags '-extldflags "-static" -X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-server github.com/laszlocph/drone-oss-08/cmd/drone-server
|
2019-04-04 18:51:20 +00:00
|
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-agent github.com/laszlocph/drone-oss-08/cmd/drone-agent
|
|
|
|
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm64/drone-agent github.com/laszlocph/drone-oss-08/cmd/drone-agent
|
|
|
|
GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags '-X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm/drone-agent github.com/laszlocph/drone-oss-08/cmd/drone-agent
|