drone: source buildrone key from drone in docker build

This commit is contained in:
Harvey Tindall 2023-12-20 20:06:44 +00:00
parent 83712a6937
commit c0c91b4aad
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 8 additions and 2 deletions

View File

@ -131,6 +131,9 @@ steps:
volumes:
- name: ssh_key
path: /root/drone_rsa
environment:
BUILDRONE_KEY:
from_secret: BUILDRONE_KEY
settings:
host:
from_secret: ssh2_host
@ -140,13 +143,15 @@ steps:
from_secret: ssh2_port
volumes:
- /root/.ssh/docker-build:/root/drone_rsa
envs:
- buildrone_key
key_path: /root/drone_rsa
command_timeout: 50m
script:
- /mnt/buildx/jfa-go/build.sh
- wget https://builds.hrfee.pw/upload.py -O /mnt/buildx/jfa-go/jfa-go/upload.py
- 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
trigger:
branch:

View File

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