Skip to content

Commit

Permalink
Remove inrepo config (kyma-project#10693)
Browse files Browse the repository at this point in the history
* Remove inrepo config

* Remove not used function
  • Loading branch information
Sawthis authored May 17, 2024
1 parent ee45fe0 commit b1613d1
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 139 deletions.
2 changes: 0 additions & 2 deletions cmd/image-detector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
```
52 changes: 0 additions & 52 deletions cmd/image-detector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"fmt"
"io"
"log"
"os"
"sort"
Expand Down Expand Up @@ -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
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
71 changes: 0 additions & 71 deletions prow/image-detector/inrepo-config.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions prow/jobs/kyma-project/test-infra/prow-periodics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 0 additions & 5 deletions templates/data/test-infra/image-detector.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions templates/templates/image-detector-inrepo.tmpl

This file was deleted.

0 comments on commit b1613d1

Please sign in to comment.