diff --git a/cmd/image-detector/README.md b/cmd/image-detector/README.md index 1607fced27cc..43c7a3609cb2 100644 --- a/cmd/image-detector/README.md +++ b/cmd/image-detector/README.md @@ -28,8 +28,6 @@ Usage of image-detector: path to the Tekton catalog directory --autobump-config path to the config for autobumper for security scanner config - --inrepo-config - path to the configuration of repositories with Prow inrepo config enabled --github-token-path path to github token for fetching inrepo config (default: "/etc/github/token") ``` diff --git a/cmd/image-detector/main.go b/cmd/image-detector/main.go index 1c5a6dd9323c..7fcc34449e75 100644 --- a/cmd/image-detector/main.go +++ b/cmd/image-detector/main.go @@ -3,7 +3,6 @@ package main import ( "context" "fmt" - "io" "log" "os" "sort" @@ -36,9 +35,6 @@ var ( // AutobumpConfig contains root path to config for autobumper for sec-scanners-config AutobumpConfig string - // InRepoConfig contains path to the configuration of repositories with Prow inrepo config enabled - InRepoConfig string - // GithubTokenPath path to file containing github token for fetching inrepo config GithubTokenPath string ) @@ -102,38 +98,6 @@ var rootCmd = &cobra.Command{ images = append(images, imgs...) } - // get prow jobs configuration from in-repo configuration - if InRepoConfig != "" { - // load InRepo configuration - file, err := os.Open(InRepoConfig) - if err != nil { - log.Fatalf("failed to load inrepo configuration: %s", err) - } - - // parse configuration - var cfg []extractimageurls.Repository - err = yaml.NewDecoder(file).Decode(&cfg) - if err != nil { - log.Fatalf("failed to decode inrepo configuration: %s", err) - } - - // load github token from env - ghToken, err := loadGithubToken(GithubTokenPath) - if err != nil { - log.Fatalf("failed to load github token from %s: %s", GithubTokenPath, err) - } - - for _, repo := range cfg { - imgs, err := extractimageurls.FromInRepoConfig(repo, ghToken) - if err != nil { - log.Printf("warn: failed to extract image urls from repository %s: %v", &repo, err) - continue - } - - images = append(images, imgs...) - } - } - images = extractimageurls.UniqueImages(images) // sort list of images to have consistent order @@ -161,7 +125,6 @@ func init() { rootCmd.PersistentFlags().StringVar(&SecScannerConfig, "sec-scanner-config", "", "path to the security scanner config field") rootCmd.PersistentFlags().StringVar(&KubernetesFiles, "kubernetes-dir", "", "path to the directory containing Kubernetes deployments") rootCmd.PersistentFlags().StringVar(&AutobumpConfig, "autobump-config", "", "path to the config for autobumper for security scanner config") - rootCmd.PersistentFlags().StringVar(&InRepoConfig, "inrepo-config", "", "path to the configuration of repositories with Prow inrepo config enabled") rootCmd.PersistentFlags().StringVar(&GithubTokenPath, "github-token-path", "/etc/github/token", "path to github token for fetching inrepo config") rootCmd.MarkFlagRequired("sec-scanner-config") @@ -173,21 +136,6 @@ func main() { } } -// loadGithubToken read github token from given file -func loadGithubToken(path string) (string, error) { - f, err := os.Open(path) - if err != nil { - return "", err - } - - data, err := io.ReadAll(f) - if err != nil { - return "", err - } - - return string(data), nil -} - // client is bumper client type client struct { o *options diff --git a/prow/cluster/resources/gatekeeper-constraints/workloads/kymaAutobumpBotGithubTokenTrustedUsage.yaml b/prow/cluster/resources/gatekeeper-constraints/workloads/kymaAutobumpBotGithubTokenTrustedUsage.yaml index a3eebb68a082..8741b91aa123 100644 --- a/prow/cluster/resources/gatekeeper-constraints/workloads/kymaAutobumpBotGithubTokenTrustedUsage.yaml +++ b/prow/cluster/resources/gatekeeper-constraints/workloads/kymaAutobumpBotGithubTokenTrustedUsage.yaml @@ -24,7 +24,7 @@ spec: command: - /tools/entrypoint args: [] - entrypoint_options: '^{.*"args":\["\/ko-app\/image-detector","--prow-config=prow\/config\.yaml","--prow-jobs-dir=prow\/jobs","--terraform-dir=configs\/terraform","--sec-scanner-config=sec-scanners-config\.yaml","--kubernetes-dir=prow\/cluster\/components","--autobump-config=configs\/autobump-config\/test-infra-sec-config-autobump-config\.yaml","--inrepo-config=prow\/image-detector\/inrepo-config\.yaml"\],"container_name":"test",.*}$' + entrypoint_options: '^{.*"args":\["\/ko-app\/image-detector","--prow-config=prow\/config\.yaml","--prow-jobs-dir=prow\/jobs","--terraform-dir=configs\/terraform","--sec-scanner-config=sec-scanners-config\.yaml","--kubernetes-dir=prow\/cluster\/components","--autobump-config=configs\/autobump-config\/test-infra-sec-config-autobump-config\.yaml"\],"container_name":"test",.*}$' # Prowjob name: ci-prow-autobump - image: "gcr.io/k8s-prow/generic-autobumper:*" command: diff --git a/prow/image-detector/inrepo-config.yaml b/prow/image-detector/inrepo-config.yaml deleted file mode 100644 index ea3a648a7172..000000000000 --- a/prow/image-detector/inrepo-config.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# Code generated by rendertemplates. DO NOT EDIT. - - -- name: test-infra - owner: kyma-project -- name: kyma - owner: kyma-project -- name: busola - owner: kyma-project -- name: control-plane - owner: kyma-project -- name: cli - owner: kyma-project -- name: lifecycle-manager - owner: kyma-project -- name: third-party-images - owner: kyma-project -- name: community - owner: kyma-project -- name: hydroform - owner: kyma-project -- name: private-fn-for-e2e-serverless-tests - owner: kyma-project -- name: examples - owner: kyma-project -- name: api-gateway - owner: kyma-project -- name: istio - owner: kyma-project -- name: runtime-watcher - owner: kyma-project -- name: keda-manager - owner: kyma-project -- name: kyma-dashboard - owner: kyma-project -- name: application-connector-manager - owner: kyma-project -- name: template-repository - owner: kyma-project -- name: btp-manager - owner: kyma-project -- name: kyma-environment-broker - owner: kyma-project -- name: telemetry-manager - owner: kyma-project -- name: compass-manager - owner: kyma-project -- name: compass - owner: kyma-incubator -- name: ord-service - owner: kyma-incubator -- name: reconciler - owner: kyma-incubator -- name: compass-console - owner: kyma-incubator -- name: sap-btp-service-operator - owner: kyma-incubator -- name: slack-bot - owner: kyma-incubator -- name: migrate - owner: kyma-incubator -- name: github-dashboard - owner: kyma-incubator -- name: kymart - owner: kyma-incubator -- name: opensap - owner: kyma-incubator -- name: service-catalog-tester - owner: kyma-incubator -- name: service-catalog - owner: kyma-incubator \ No newline at end of file diff --git a/prow/jobs/kyma-project/test-infra/prow-periodics.yaml b/prow/jobs/kyma-project/test-infra/prow-periodics.yaml index 0eaa658fe0cd..a809aaab61ee 100644 --- a/prow/jobs/kyma-project/test-infra/prow-periodics.yaml +++ b/prow/jobs/kyma-project/test-infra/prow-periodics.yaml @@ -66,7 +66,6 @@ postsubmits: # runs on main - "--sec-scanner-config=sec-scanners-config.yaml" - "--kubernetes-dir=prow/cluster/components" - "--autobump-config=configs/autobump-config/test-infra-sec-config-autobump-config.yaml" - - "--inrepo-config=prow/image-detector/inrepo-config.yaml" - name: post-test-infra-deploy-prow annotations: description: "Deploy prow components" @@ -168,7 +167,6 @@ periodics: # runs on schedule - "--sec-scanner-config=sec-scanners-config.yaml" - "--kubernetes-dir=prow/cluster/components" - "--autobump-config=configs/autobump-config/test-infra-sec-config-autobump-config.yaml" - - "--inrepo-config=prow/image-detector/inrepo-config.yaml" - name: ci-prow-autobump-jobs annotations: description: "Autobump image versions in prow jobs" diff --git a/templates/data/test-infra/image-detector.yaml b/templates/data/test-infra/image-detector.yaml deleted file mode 100644 index dcb624fc24e3..000000000000 --- a/templates/data/test-infra/image-detector.yaml +++ /dev/null @@ -1,5 +0,0 @@ -templates: - - from: image-detector-inrepo.tmpl - render: - - to: "../../prow/image-detector/inrepo-config.yaml" - diff --git a/templates/templates/image-detector-inrepo.tmpl b/templates/templates/image-detector-inrepo.tmpl deleted file mode 100644 index 852092129c01..000000000000 --- a/templates/templates/image-detector-inrepo.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -{{- range $org := .Global.orgs }} -{{- range $repo := .repos }} -- name: {{ $repo.name }} - owner: {{ $org.name }} -{{- end }} -{{- end }} \ No newline at end of file