feat(secrets): promote env secrets to task

This commit is contained in:
fiftin 2024-07-03 00:45:43 +05:00
parent c75e79efad
commit 46048ef770
No known key found for this signature in database
GPG Key ID: 044381366A5D4731
2 changed files with 22 additions and 0 deletions

View File

@ -206,6 +206,10 @@ func (t *LocalJob) getTerraformArgs(username string, incomingVersion *string) (a
args = append(args, "-var", fmt.Sprintf("%s=%s", name, value)) args = append(args, "-var", fmt.Sprintf("%s=%s", name, value))
} }
for _, secret := range t.Environment.Secrets {
args = append(args, "-var", fmt.Sprintf("%s=%s", secret.Name, secret.Secret))
}
return return
} }

View File

@ -274,6 +274,24 @@ func (t *TaskRunner) populateDetails() error {
if err != nil { if err != nil {
return err return err
} }
var secrets []db.AccessKey
secrets, err = t.pool.store.GetEnvironmentSecrets(t.Template.ProjectID, *t.Template.EnvironmentID)
if err != nil {
return err
}
for _, s := range secrets {
err = s.DeserializeSecret()
if err != nil {
return err
}
t.Environment.Secrets = append(t.Environment.Secrets, db.EnvironmentSecret{
ID: s.ID,
Name: s.Name,
Secret: s.String,
})
}
} }
if t.Task.Environment != "" { if t.Task.Environment != "" {