Skip to content

Commit

Permalink
fix: unable to pull shared secrets (#51)
Browse files Browse the repository at this point in the history
* fix: unable to pull shared secrets

* fix: swap equalfold to length check

* fix: add empty line

* fix: use var block
  • Loading branch information
Neal authored and jbrockopp committed Jan 3, 2020
1 parent c29970e commit 8e291fb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions executor/linux/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ func (c *client) getShared(s *pipeline.Secret) (*library.Secret, error) {
c.logger.Tracef("pulling %s %s secret %s", s.Engine, s.Type, s.Name)

// variables necessary for secret
var team string
var (
team string
org string
)

org := c.repo.GetOrg()
path := s.Key

// check if the full path was provided
Expand All @@ -179,13 +181,13 @@ func (c *client) getShared(s *pipeline.Secret) (*library.Secret, error) {
return nil, fmt.Errorf("path %s for %s secret %s is invalid", s.Key, s.Type, s.Name)
}

// check if the org provided matches what we expect
if strings.EqualFold(parts[0], org) {
// check if the org provided is not empty
if len(parts[0]) == 0 {
// update the org variable
org = parts[0]

// check if the team provided matches what we expect
if strings.EqualFold(parts[1], team) {
// check if the team provided is not empty
if len(parts[1]) == 0 {
// update the variables
team = parts[1]
path = parts[2]
Expand Down

0 comments on commit 8e291fb

Please sign in to comment.