1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 17:10:10 +00:00

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: 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:

View File

@ -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
} }