@@ -199,8 +199,12 @@ func (c *client) PlanBuild(ctx context.Context) error {
199199
200200 _log .AppendData (append (sRaw , "\n " ... ))
201201
202- // add secret to the map
203- c .Secrets [secret .Name ] = s
202+ // add secret to the appropriate map
203+ if s .GetAllowSubstitution () {
204+ c .Secrets [secret .Name ] = s
205+ } else {
206+ c .NoSubSecrets [secret .Name ] = s
207+ }
204208 }
205209
206210 // escape newlines in secrets loaded on build_start
@@ -699,6 +703,7 @@ func loadLazySecrets(c *client, _step *pipeline.Container) error {
699703 _log := new (library.Log )
700704
701705 lazySecrets := make (map [string ]* library.Secret )
706+ lazyNoSubSecrets := make (map [string ]* library.Secret )
702707
703708 // this requires a small preface and brief description on
704709 // how normal secrets make it into a container:
@@ -797,8 +802,12 @@ func loadLazySecrets(c *client, _step *pipeline.Container) error {
797802 return err
798803 }
799804
800- // add secret to the temp map
801- lazySecrets [secret .Name ] = s
805+ // add secret to the appropriate temp map
806+ if s .GetAllowSubstitution () {
807+ lazySecrets [secret .Name ] = s
808+ } else {
809+ lazyNoSubSecrets [secret .Name ] = s
810+ }
802811 }
803812 }
804813
@@ -836,6 +845,13 @@ func loadLazySecrets(c *client, _step *pipeline.Container) error {
836845 return err
837846 }
838847
848+ c .Logger .Debug ("injecting no-sub lazy loaded secrets" )
849+ // inject secrets for container
850+ err = injectSecrets (tmpStep , lazyNoSubSecrets )
851+ if err != nil {
852+ return err
853+ }
854+
839855 c .Logger .Debug ("merge lazy loaded secrets into container" )
840856 // merge lazy load secrets into original container
841857 err = _step .MergeEnv (tmpStep .Environment )
0 commit comments