Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,352 changes: 220 additions & 1,132 deletions .drone.yml

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions dronegen/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ type kubernetesRoleSettings struct {
append bool
}

// macRoleSettings contains the info necessary to assume an AWS role and save the credentials to a path that later steps can use
type macRoleSettings struct {
awsRoleSettings
configPath string
name string
profile string
append bool
}

// kuberentesS3Settings contains all info needed to download from S3 in a kubernetes pipeline
type kubernetesS3Settings struct {
region string
Expand Down Expand Up @@ -104,23 +95,6 @@ func kubernetesAssumeAwsRoleStep(s kubernetesRoleSettings) step {
}
}

// macAssumeAwsRoleStep builds a step to assume an AWS role and save it to a host path that later steps can use
func macAssumeAwsRoleStep(s macRoleSettings) step {
if s.name == "" {
s.name = "Assume AWS Role"
}
return step{
Name: s.name,
Environment: map[string]value{
"AWS_ACCESS_KEY_ID": s.awsAccessKeyID,
"AWS_SECRET_ACCESS_KEY": s.awsSecretAccessKey,
"AWS_ROLE": s.role,
"AWS_SHARED_CREDENTIALS_FILE": value{raw: s.configPath},
},
Commands: assumeRoleCommands(s.profile, s.configPath, s.append),
}
}

// kubernetesUploadToS3Step generates an S3 upload step
func kubernetesUploadToS3Step(s kubernetesS3Settings) step {
return step{
Expand Down
11 changes: 9 additions & 2 deletions dronegen/gha.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ package main

import (
"fmt"
"sort"
"strings"
"time"

"golang.org/x/exp/maps"
)

type ghaBuildType struct {
Expand Down Expand Up @@ -54,8 +57,12 @@ func ghaBuildPipeline(b ghaBuildType) pipeline {
fmt.Fprintf(&cmd, `-input oss-teleport-ref=${%s} `, b.srcRefVar)
}

for k, v := range b.inputs {
fmt.Fprintf(&cmd, `-input "%s=%s" `, k, v)
// Sort inputs so the are output in a consistent order to avoid
// spurious changes in the generated drone config.
keys := maps.Keys(b.inputs)
sort.Strings(keys)
for _, k := range keys {
fmt.Fprintf(&cmd, `-input "%s=%s" `, k, b.inputs[k])
}

p.Steps = []step{
Expand Down
Loading