Skip to content

Commit 251332b

Browse files
fix(build, image-spec): remove werf SSH_AUTH_SOCK env that persist after build
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
1 parent 71a4cf7 commit 251332b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/build/stage/image_spec.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/werf/werf/v2/pkg/dockerfile"
1515
"github.com/werf/werf/v2/pkg/dockerfile/frontend"
1616
"github.com/werf/werf/v2/pkg/image"
17+
"github.com/werf/werf/v2/pkg/ssh_agent"
1718
"github.com/werf/werf/v2/pkg/werf/global_warnings"
1819
)
1920

@@ -113,7 +114,7 @@ func (s *ImageSpecStage) PrepareImage(ctx context.Context, _ Conveyor, _ contain
113114
return nil
114115
}
115116

116-
const imageSpecStageCacheVersion = "1"
117+
const imageSpecStageCacheVersion = "2"
117118

118119
func (s *ImageSpecStage) GetDependencies(_ context.Context, _ Conveyor, _ container_backend.ContainerBackend, _, _ *StageImage, _ container_backend.BuildContextArchiver) (string, error) {
119120
var args []string
@@ -210,7 +211,7 @@ func modifyEnv(env, removeKeys []string, addKeysMap map[string]string) ([]string
210211
delete(baseEnvMap, key)
211212
}
212213

213-
// FIXME: This is a temporary solution to remove werf labels that persist after build.
214+
// FIXME: This is a temporary solution to remove werf commit envs that persist after build.
214215
for _, key := range []string{
215216
"WERF_COMMIT_HASH",
216217
"WERF_COMMIT_TIME_HUMAN",
@@ -219,6 +220,11 @@ func modifyEnv(env, removeKeys []string, addKeysMap map[string]string) ([]string
219220
delete(baseEnvMap, key)
220221
}
221222

223+
// FIXME: This is a temporary solution to remove werf SSH_AUTH_SOCK that persist after build.
224+
if envValue, hasEnv := baseEnvMap[ssh_agent.SSHAuthSockEnv]; hasEnv && envValue == container_backend.SSHContainerAuthSockPath {
225+
delete(baseEnvMap, ssh_agent.SSHAuthSockEnv)
226+
}
227+
222228
envMapToExpand := make(map[string]string)
223229
for key, value := range baseEnvMap {
224230
envMapToExpand[key] = value

0 commit comments

Comments
 (0)