Skip to content

Commit

Permalink
feat: set remote file attribute to before expansions
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackarySantana committed Dec 10, 2024
1 parent b6b4de2 commit a89b8c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion agent/command/s3_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ type s3get struct {
// RemoteFile is the file path of the file to get, within its bucket.
RemoteFile string `mapstructure:"remote_file" plugin:"expand"`

// remoteFile is the file path without any expansions applied.
remoteFile string

// Region is the S3 region where the bucket is located. It defaults to
// "us-east-1".
Region string `mapstructure:"region" plugin:"region"`
Expand Down Expand Up @@ -144,6 +147,8 @@ func (c *s3get) shouldRunForVariant(buildVariantName string) bool {
// Apply the expansions from the relevant task config
// to all appropriate fields of the s3get.
func (c *s3get) expandParams(conf *internal.TaskConfig) error {
c.remoteFile = c.RemoteFile

var err error
if err = util.ExpandValues(c, &conf.Expansions); err != nil {
return errors.Wrap(err, "applying expansions")
Expand Down Expand Up @@ -175,7 +180,7 @@ func (c *s3get) Execute(ctx context.Context,
trace.SpanFromContext(ctx).SetAttributes(
attribute.String(s3GetBucketAttribute, c.Bucket),
attribute.Bool(s3GetTemporaryCredentialsAttribute, c.AwsSessionToken != ""),
attribute.String(s3GetRemoteFileAttribute, c.RemoteFile),
attribute.String(s3GetRemoteFileAttribute, c.remoteFile),
)

// create pail bucket
Expand Down

0 comments on commit a89b8c6

Please sign in to comment.