Skip to content

Commit

Permalink
cleanup: deprecate git-fallback-clone
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kotzbauer <[email protected]>
  • Loading branch information
ckotzbauer committed Dec 4, 2022
1 parent f928128 commit c107f84
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
FROM ghcr.io/ckotzbauer/distroless-git-slim
FROM alpine:3.17@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4 as alpine

ARG TARGETARCH

RUN set -eux; \
apk add -U --no-cache ca-certificates


FROM scratch

ARG TARGETOS
ARG TARGETARCH

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY dist/sbom-operator_${TARGETOS}_${TARGETARCH}*/sbom-operator /usr/local/bin/sbom-operator
COPY hack/git-ask-pass.sh /usr/local/bin/git-ask-pass.sh

ENTRYPOINT ["/usr/local/bin/sbom-operator"]
7 changes: 0 additions & 7 deletions hack/git-ask-pass.sh

This file was deleted.

1 change: 0 additions & 1 deletion internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Config struct {
GitPassword string `yaml:"gitPassword" env:"SBOM_GIT_PASSWORD" flag:"git-password"`
GitAuthorName string `yaml:"gitAuthorName" env:"SBOM_GIT_AUTHOR_NAME" flag:"git-author-name"`
GitAuthorEmail string `yaml:"gitAuthorEmail" env:"SBOM_GIT_AUTHOR_EMAIL" flag:"git-author-email"`
GitFallbackClone bool `yaml:"gitFallbackClone" env:"SBOM_GIT_FALLBACK_CLONE" flag:"git-fallback-clone"`
GitHubAppId string `yaml:"githubAppId" env:"SBOM_GITHUB_APP_ID" flag:"github-app-id"`
GitHubAppInstallationId string `yaml:"githubAppInstallationId" env:"SBOM_GITHUB_APP_INSTALLATION_ID" flag:"github-app-installation-id"`
GitHubPrivateKey string `yaml:"githubAppPrivateKey" env:"SBOM_GITHUB_APP_PRIVATE_KEY"`
Expand Down
3 changes: 1 addition & 2 deletions internal/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ func initTargets(k8s *kubernetes.KubeClient) []target.Target {
password := internal.OperatorConfig.GitPassword
name := internal.OperatorConfig.GitAuthorName
email := internal.OperatorConfig.GitAuthorEmail
fallbackClone := internal.OperatorConfig.GitFallbackClone
githubAppId := internal.OperatorConfig.GitHubAppId
githubAppInstallationId := internal.OperatorConfig.GitHubAppInstallationId
githubAppPrivateKey := internal.OperatorConfig.GitHubPrivateKey
t := git.NewGitTarget(workingTree, workPath, repository, branch, name, email, token, userName, password, githubAppId, githubAppInstallationId, githubAppPrivateKey, format, fallbackClone)
t := git.NewGitTarget(workingTree, workPath, repository, branch, name, email, token, userName, password, githubAppId, githubAppInstallationId, githubAppPrivateKey, format)
err = t.ValidateConfig()
targets = append(targets, t)
} else if ta == "dtrack" {
Expand Down
4 changes: 2 additions & 2 deletions internal/target/git/git_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type GitTarget struct {
sbomFormat string
}

func NewGitTarget(workingTree, path, repo, branch, name, email, token, userName, password, githubAppID, githubAppInstallationID, githubAppPrivateKey, format string, fallbackClone bool) *GitTarget {
gitAccount := git.New(name, email, token, userName, password, githubAppID, githubAppInstallationID, githubAppPrivateKey, fallbackClone)
func NewGitTarget(workingTree, path, repo, branch, name, email, token, userName, password, githubAppID, githubAppInstallationID, githubAppPrivateKey, format string) *GitTarget {
gitAccount := git.New(name, email, token, userName, password, githubAppID, githubAppInstallationID, githubAppPrivateKey, false)

return &GitTarget{
workingTree: workingTree,
Expand Down
12 changes: 6 additions & 6 deletions internal/target/git/git_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ func TestImageIDToFilePath(t *testing.T) {
{
input: "alpine:latest",
expected: "alpine_latest/sbom.json",
g: NewGitTarget("", "", "", "", "", "", "", "", "", "", "", "", "", false),
g: NewGitTarget("", "", "", "", "", "", "", "", "", "", "", "", ""),
},
{
input: "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300",
expected: "alpine/sha256_21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300/sbom.json",
g: NewGitTarget("", "", "", "", "", "", "", "", "", "", "", "", "", false),
g: NewGitTarget("", "", "", "", "", "", "", "", "", "", "", "", ""),
},
{
input: "",
expected: "sbom.json",
g: NewGitTarget("", "", "", "", "", "", "", "", "", "", "", "", "", false),
g: NewGitTarget("", "", "", "", "", "", "", "", "", "", "", "", ""),
},
{
input: "alpine:latest",
expected: "/git/dev/alpine_latest/sbom.spdx",
g: NewGitTarget("/git", "dev", "", "", "", "", "", "", "", "", "", "", "spdx", false),
g: NewGitTarget("/git", "dev", "", "", "", "", "", "", "", "", "", "", "spdx"),
},
{
input: "alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300",
expected: "/git/sbom/prod/cluster1/alpine/sha256_21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300/sbom.spdx",
g: NewGitTarget("/git/sbom", "prod/cluster1", "", "", "", "", "", "", "", "", "", "", "spdx", false),
g: NewGitTarget("/git/sbom", "prod/cluster1", "", "", "", "", "", "", "", "", "", "", "spdx"),
},
{
input: "",
expected: "/git/sbom.json",
g: NewGitTarget("/git", "", "", "", "", "", "", "", "", "", "", "", "", false),
g: NewGitTarget("/git", "", "", "", "", "", "", "", "", "", "", "", ""),
},
}

Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ func newRootCmd() *cobra.Command {
rootCmd.PersistentFlags().String(internal.ConfigKeyOciRegistry, "", "OCI-Registry")
rootCmd.PersistentFlags().String(internal.ConfigKeyOciUser, "", "OCI-User")
rootCmd.PersistentFlags().String(internal.ConfigKeyOciToken, "", "OCI-Token")

rootCmd.PersistentFlags().MarkDeprecated(internal.ConfigKeyGitFallbackClone, "'multi_ack' is supported by default. The flag doesn't have any effect and will be removed in 0.25.0")
return rootCmd
}

Expand Down

0 comments on commit c107f84

Please sign in to comment.