Skip to content

Commit

Permalink
resolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaizanse committed Sep 17, 2024
2 parents 445aae6 + 3612578 commit 55d44c7
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 35 deletions.
2 changes: 1 addition & 1 deletion cmd/image-syncer/external-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ images:
- source: "python@sha256:11d30cce970c40aee8e993d302a15f8bc8204ecab7af1bae26b3fd00eb75ada2"
tag: "3.12-slim-bullseye"
- source: "fluent/fluent-bit@sha256:def31c22bfc23002354d0cc2beb177e4da1d87c68f49e8fee76c896e8c6fdd44"
tag: "3.1.6" # used by the kyma telemetry module
tag: "3.1.8" # used by the kyma telemetry module
- source: "node@sha256:ba898e86c2cc720c8cf2ae05f8d2d4697fe0c8ca3e920d6fbf14a6cbf50bb9ca"
tag: "alpine3.20"
- source: "moby/buildkit:v0.15.2-rootless"
Expand Down
23 changes: 16 additions & 7 deletions cmd/image-syncer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"os/signal"
"syscall"

"github.com/kyma-project/test-infra/pkg/imagesync"

"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
"github.com/kyma-project/test-infra/pkg/imagesync"
"github.com/pkg/errors"

"github.com/jamiealquiza/envy"
Expand All @@ -28,6 +27,7 @@ var (
type Config struct {
ImagesFile string
TargetKeyFile string
AccessToken string
DryRun bool
Debug bool
}
Expand Down Expand Up @@ -180,7 +180,12 @@ func SyncImage(ctx context.Context, src, dest string, dryRun bool, auth authn.Au

// SyncImages is a main syncing function that takes care of copying images.
func SyncImages(ctx context.Context, cfg *Config, images *imagesync.SyncDef, authCfg []byte) error {
auth := &authn.Basic{Username: "_json_key", Password: string(authCfg)}
var auth authn.Authenticator
if cfg.TargetKeyFile != "" {
auth = &authn.Basic{Username: "_json_key", Password: string(authCfg)}
} else {
auth = &authn.Bearer{Token: string(authCfg)}
}
for _, img := range images.Images {
target, err := getTarget(img.Source, images.TargetRepoPrefix, img.Tag)
imageType := "Index"
Expand Down Expand Up @@ -224,6 +229,7 @@ func main() {
Long: `image-syncer copies docker images. It compares checksum between source and target and protects target images against overriding`,
//nolint:revive
Run: func(cmd *cobra.Command, args []string) {
var authCfg []byte
logLevel := logrus.InfoLevel
if cfg.Debug {
logLevel = logrus.DebugLevel
Expand All @@ -237,9 +243,11 @@ func main() {
if err != nil {
log.WithError(err).Fatal("Could not parse images file")
}
authCfg, err := os.ReadFile(cfg.TargetKeyFile)
if err != nil {
log.WithError(err).Fatal("Could not open target auth key JSON")
if cfg.TargetKeyFile != "" {
authCfg, err = os.ReadFile(cfg.TargetKeyFile)
if err != nil {
log.WithError(err).Fatal("Could not open target auth key JSON")
}
}

if cfg.DryRun {
Expand All @@ -260,11 +268,12 @@ func main() {

rootCmd.PersistentFlags().StringVarP(&cfg.ImagesFile, "images-file", "i", "", "Specifies the path to the YAML file that contains list of images")
rootCmd.PersistentFlags().StringVarP(&cfg.TargetKeyFile, "target-repo-auth-key", "t", "", "Specifies the JSON key file used for authorization to the target repository")
rootCmd.PersistentFlags().StringVarP(&cfg.AccessToken, "access-token", "a", "", "Specifies the access token used for authorization to the target repository")
rootCmd.PersistentFlags().BoolVar(&cfg.DryRun, "dry-run", false, "Enables the dry-run mode")
rootCmd.PersistentFlags().BoolVar(&cfg.Debug, "debug", false, "Enables the debug mode")

rootCmd.MarkPersistentFlagRequired("images-file")
rootCmd.MarkPersistentFlagRequired("target-repo-auth-key")
rootCmd.MarkFlagsOneRequired("target-repo-auth-key", "access-token")
envy.ParseCobra(rootCmd, envy.CobraConfig{Prefix: "SYNCER", Persistent: true, Recursive: false})

if err := rootCmd.Execute(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion configs/terraform/core/apis.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "6.2.0"
version = "6.3.0"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
project_id = "sap-kyma-neighbors-dev"
region = "europe-west3"
service_account_keys_rotator_service_name = "service-account-keys-rotator"
service_account_keys_rotator_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/rotate-service-account:v20240912-fcc91334" #gitleaks:allow
service_account_keys_rotator_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/rotate-service-account:v20240916-af720dce" #gitleaks:allow
service_account_keys_cleaner_service_name = "service-account-keys-cleaner"
service_account_keys_cleaner_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/service-account-keys-cleaner:v20240912-fcc91334" #gitleaks:allow
service_account_keys_cleaner_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/service-account-keys-cleaner:v20240916-af720dce" #gitleaks:allow
service_account_key_latest_version_min_age = 24
service_account_keys_cleaner_scheduler_cron_schedule = "0 0 * * 1-5"
4 changes: 2 additions & 2 deletions configs/terraform/environments/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ kyma_project_artifact_registry_collection = {
},
}
service_account_keys_rotator_service_name = "service-account-keys-rotator"
service_account_keys_rotator_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/rotate-service-account:v20240912-fcc91334" #gitleaks:allow
service_account_keys_rotator_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/rotate-service-account:v20240916-af720dce" #gitleaks:allow
service_account_keys_cleaner_service_name = "service-account-keys-cleaner"
service_account_keys_cleaner_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/service-account-keys-cleaner:v20240912-fcc91334" #gitleaks:allow
service_account_keys_cleaner_image = "europe-docker.pkg.dev/kyma-project/prod/test-infra/service-account-keys-cleaner:v20240916-af720dce" #gitleaks:allow
service_account_key_latest_version_min_age = 24
service_account_keys_cleaner_scheduler_cron_schedule = "0 0 * * 1-5"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/tidwall/gjson v1.17.3
github.com/zricethezav/gitleaks/v8 v8.18.4
github.com/zricethezav/gitleaks/v8 v8.19.2
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/net v0.29.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zricethezav/gitleaks/v8 v8.18.4 h1:mWOfVGO8ksok21iOb7h4DZMcUxyvsol8l6o1uNOQxww=
github.com/zricethezav/gitleaks/v8 v8.18.4/go.mod h1:3EFYK+ZNDHPNQinyZTVGHG7/sFsApEZ9DrCGA1AP63M=
github.com/zricethezav/gitleaks/v8 v8.19.2 h1:tpV/mAdMy1FMgPb6KYaYHfCsIFqvHaVYyd18AN4txYI=
github.com/zricethezav/gitleaks/v8 v8.19.2/go.mod h1:3EFYK+ZNDHPNQinyZTVGHG7/sFsApEZ9DrCGA1AP63M=
go.einride.tech/aip v0.68.0 h1:4seM66oLzTpz50u4K1zlJyOXQ3tCzcJN7I22tKkjipw=
go.einride.tech/aip v0.68.0/go.mod h1:7y9FF8VtPWqpxuAxl0KQWqaULxW4zFIesD6zF5RIHHg=
go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ presubmits: # runs on PRs
- ^release-\d+\.\d+(-.*)?$
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -75,7 +75,7 @@ postsubmits: # runs on main
channel: goat-int
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down
4 changes: 2 additions & 2 deletions prow/jobs/kyma-project/istio/istio-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ postsubmits: # runs on main
channel: goat-int
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -82,7 +82,7 @@ postsubmits: # runs on main
channel: goat-int
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ presubmits: # runs on PRs
max_concurrency: 10
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -71,7 +71,7 @@ postsubmits: # runs on main
- ^main$
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -123,7 +123,7 @@ postsubmits: # runs on main
- ^\d+\.\d+\.\d+(?:-.*)?$ # Watches for new Tag
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down
8 changes: 4 additions & 4 deletions prow/jobs/kyma-project/test-infra/buildpack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ presubmits: # runs on PRs
- ^main$
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -67,7 +67,7 @@ presubmits: # runs on PRs
- ^main$
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -120,7 +120,7 @@ postsubmits: # runs on main
- ^main$
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -171,7 +171,7 @@ postsubmits: # runs on main
- ^main$
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down
4 changes: 2 additions & 2 deletions prow/jobs/kyma-project/test-infra/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ presubmits: # runs on PRs
max_concurrency: 10
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down Expand Up @@ -99,7 +99,7 @@ postsubmits:
max_concurrency: 10
spec:
containers:
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
- image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
securityContext:
privileged: false
seccompProfile:
Expand Down
6 changes: 3 additions & 3 deletions sec-scanners-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ protecode:
- docker.io/library/nginx:1.25.4-alpine
- europe-docker.pkg.dev/gardener-project/releases/ci-infra/cla-assistant:v20240412-d22f4bf
- europe-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli:0.12.0
- europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334
- europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce
- europe-docker.pkg.dev/kyma-project/prod/test-infra/ginkgo:v20240909-95731ea6
- europe-docker.pkg.dev/kyma-project/prod/test-infra/golangci-lint:v20240910-83aca12b
- europe-docker.pkg.dev/kyma-project/prod/test-infra/ko/automated-approver:v20240909-fe70e5ff
Expand All @@ -27,8 +27,8 @@ protecode:
- europe-docker.pkg.dev/kyma-project/prod/test-infra/ko/search-github-issue:v20240909-fe70e5ff
- europe-docker.pkg.dev/kyma-project/prod/test-infra/ko/usersmapchecker:v20240909-fe70e5ff
- europe-docker.pkg.dev/kyma-project/prod/test-infra/ko/vmscollector:v20240909-fe70e5ff
- europe-docker.pkg.dev/kyma-project/prod/test-infra/rotate-service-account:v20240912-fcc91334
- europe-docker.pkg.dev/kyma-project/prod/test-infra/service-account-keys-cleaner:v20240912-fcc91334
- europe-docker.pkg.dev/kyma-project/prod/test-infra/rotate-service-account:v20240916-af720dce
- europe-docker.pkg.dev/kyma-project/prod/test-infra/service-account-keys-cleaner:v20240916-af720dce
- europe-docker.pkg.dev/kyma-project/prod/test-infra/slackmessagesender:v20240910-c199525c
- europe-docker.pkg.dev/kyma-project/prod/testimages/alpine-hadolint:v20240910-541771db
- europe-docker.pkg.dev/kyma-project/prod/testimages/alpine-shellcheck:v20240910-541771db
Expand Down
4 changes: 2 additions & 2 deletions templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ globalSets:
decorate: "true"
pubsub_project: "sap-kyma-prow"
pubsub_topic: "prowjobs"
image: europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334
image: europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce
command: /image-builder
request_memory: "1.5Gi"
request_cpu: "1"
Expand All @@ -60,7 +60,7 @@ globalSets:
decorate: "true"
pubsub_project: "sap-kyma-prow"
pubsub_topic: "prowjobs"
image: europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334
image: europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce
command: /image-builder
request_memory: "1.5Gi"
request_cpu: "1"
Expand Down
2 changes: 1 addition & 1 deletion templates/data/istio-module-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ templates:
decorate: "true"
pubsub_project: "sap-kyma-prow"
pubsub_topic: "prowjobs"
image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240912-fcc91334"
image: "europe-docker.pkg.dev/kyma-project/prod/image-builder:v20240916-af720dce"
command: /image-builder
request_memory: "1.5Gi"
request_cpu: "1"
Expand Down

0 comments on commit 55d44c7

Please sign in to comment.