-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(giterminism): add build secrets (#6436)
Signed-off-by: Yaroslav Pershin <62902094+iapershin@users.noreply.github.com> Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com> Co-authored-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
- Loading branch information
1 parent
51ae036
commit 266dc99
Showing
7 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package inspector | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
var secretsErrMsg = `secret %q is not allowed by giterminism | ||
Using env and file secrets complicates the sharing and reproducibility of the configuration in CI jobs and among developers.` | ||
|
||
func (i Inspector) InspectConfigSecretEnvAccepted(secret string) error { | ||
if i.sharedOptions.LooseGiterminism() { | ||
return nil | ||
} | ||
|
||
if i.giterminismConfig.IsConfigSecretEnvAccepted(secret) { | ||
return nil | ||
} | ||
|
||
return NewExternalDependencyFoundError(fmt.Sprintf(secretsErrMsg, secret)) | ||
} | ||
|
||
func (i Inspector) InspectConfigSecretSrcAccepted(secret string) error { | ||
if i.sharedOptions.LooseGiterminism() { | ||
return nil | ||
} | ||
|
||
if i.giterminismConfig.IsConfigSecretSrcAccepted(secret) { | ||
return nil | ||
} | ||
|
||
return NewExternalDependencyFoundError(fmt.Sprintf(secretsErrMsg, secret)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
giterminismConfigVersion: 1 | ||
|
||
config: | ||
secrets: | ||
allowEnvVariables: | ||
- "ENV_SECRET" | ||
allowFiles: | ||
- "./file" |