Transmit user PGP keys
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2022-09-09 14:11:34 +02:00
parent 8251fb2f96
commit 5f0888a805
1 changed files with 16 additions and 4 deletions

View File

@ -349,12 +349,24 @@ func TriggerTagUpdate(c *gin.Context, work *Work, repo *Repository, u *User, tag
repo_tag = *tag
}
var pgp_keys string
keys, err := u.GetKeys()
if err != nil {
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "Something goes really wrong with your PGP keys: unable to retrieve them."})
return
}
for _, k := range keys {
pgp_keys += k.Content + "\n"
}
client := drone.NewClient(droneEndpoint, droneConfig)
result, err := client.BuildCreate("srs", "atsebay.t-worker", "", "master", map[string]string{
"REPO_URL": repo.URI,
"REPO_TAG": repo_tag,
"LOGIN": u.Login,
"DEST": fmt.Sprintf("%d", work.Id),
"REPO_URL": repo.URI,
"REPO_TAG": repo_tag,
"USER_PGP_PUBKEY": pgp_keys,
"LOGIN": u.Login,
"DEST": fmt.Sprintf("%d", work.Id),
})
if err != nil {
log.Println("Unable to communicate with Drone:", err.Error())