drone: source buildrone key from drone in docker build

pull/322/head
Harvey Tindall 11 months ago
parent 83712a6937
commit c0c91b4aad
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -131,6 +131,9 @@ steps:
volumes: volumes:
- name: ssh_key - name: ssh_key
path: /root/drone_rsa path: /root/drone_rsa
environment:
BUILDRONE_KEY:
from_secret: BUILDRONE_KEY
settings: settings:
host: host:
from_secret: ssh2_host from_secret: ssh2_host
@ -140,13 +143,15 @@ steps:
from_secret: ssh2_port from_secret: ssh2_port
volumes: volumes:
- /root/.ssh/docker-build:/root/drone_rsa - /root/.ssh/docker-build:/root/drone_rsa
envs:
- buildrone_key
key_path: /root/drone_rsa key_path: /root/drone_rsa
command_timeout: 50m command_timeout: 50m
script: script:
- /mnt/buildx/jfa-go/build.sh - /mnt/buildx/jfa-go/build.sh
- wget https://builds.hrfee.pw/upload.py -O /mnt/buildx/jfa-go/jfa-go/upload.py - wget https://builds.hrfee.pw/upload.py -O /mnt/buildx/jfa-go/jfa-go/upload.py
- pip3 install requests - pip3 install requests
- bash -c 'cd /mnt/buildx/jfa-go/jfa-go && BUILDRONE_KEY=$(cat /mnt/buildx/jfa-go/key) python3 upload.py https://builds.hrfee.pw hrfee jfa-go --tag docker-unstable=true' - bash -c 'cd /mnt/buildx/jfa-go/jfa-go && python3 upload.py https://builds.hrfee.pw hrfee jfa-go --tag docker-unstable=true'
- rm -f /mnt/buildx/jfa-go/jfa-go/upload.py - rm -f /mnt/buildx/jfa-go/jfa-go/upload.py
trigger: trigger:
branch: branch:

@ -161,6 +161,7 @@ func newUpdater(buildroneURL, namespace, repo, version, commit, buildType string
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
binary += ".exe" binary += ".exe"
} }
fmt.Println("monitoring", tag)
return &Updater{ return &Updater{
httpClient: &http.Client{Timeout: 10 * time.Second}, httpClient: &http.Client{Timeout: 10 * time.Second},
timeoutHandler: common.NewTimeoutHandler("updater", buildroneURL, true), timeoutHandler: common.NewTimeoutHandler("updater", buildroneURL, true),
@ -211,7 +212,7 @@ func (ud *Updater) GetTag() (Tag, int, error) {
var tag Tag var tag Tag
err = json.Unmarshal(body, &tag) err = json.Unmarshal(body, &tag)
if tag.Version == "" { if tag.Version == "" {
err = errors.New("Tag was empty") err = errors.New("Tag at \"" + url + "\" was empty")
} }
return tag, resp.StatusCode, err return tag, resp.StatusCode, err
} }

Loading…
Cancel
Save