Skip to content

Commit

Permalink
Remove image-syncer amd64Only flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawthis committed Dec 5, 2024
1 parent 6d758b5 commit e0ad104
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
8 changes: 0 additions & 8 deletions cmd/image-syncer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ As an input parameter, image-syncer takes a file having the following structure:

- **source**: The source image to be copied. It can be an image name with a tag or a digest.
- **tag**: The tag of the image in the target repository, which is required when the source uses digest to identify the image.
- **amd64Only**: A boolean value that indicates if it's allowed to synchronize the image manifest instead of the image index.
This is required when the source image is not a multi-platform image.

```yaml
images:
Expand All @@ -104,10 +102,8 @@ images:
- source: "busybox@sha256:31a54a0cf86d7354788a8265f60ae6acb4b348a67efbcf7c1007dd3cf7af05ab"
tag: "1.32.0-v1"
- source: "bitnami/postgres-exporter:0.11.1-debian-11-r69"
amd64Only: true
- source: "postgres@sha256:9d7ec48fe46e8bbce55deafff58080e49d161a3ed92e67f645014bb50dc599fd"
tag: "v20230508-11.19-alpine3.17"
amd64Only: true
```

## Developer Guide
Expand All @@ -124,10 +120,6 @@ The image-syncer binary is responsible for synchronizing images between two regi
The binary is released as a container image.
See the [Dockerfile](https://github.com/kyma-project/test-infra/blob/main/cmd/image-syncer/Dockerfile) for the image-syncer binary.

> [!WARNING]
> The **amd64Only** field in the images list file allows syncing the image manifest instead of the image index.
> The flag does not prevent syncing other platforms.

#### Flags

The image-syncer binary accepts flags to configure the synchronization process.
Expand Down
26 changes: 10 additions & 16 deletions cmd/image-syncer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,17 @@ func SyncImages(ctx context.Context, cfg *Config, images *imagesync.SyncDef, aut
return err
}
log.WithField("image", img.Source).Info("Start sync")
if img.AMD64Only {
// sync whole index if possible, otherwise sync singular image
// we force users to set explicit info about single-arch images
var isIndex bool
isIndex, err = isImageIndex(ctx, img.Source)
if err != nil {
return err
}
if isIndex {
_, err = SyncIndex(ctx, img.Source, target, cfg.DryRun, auth)
} else {
imageType = "Image"
_, err = SyncImage(ctx, img.Source, target, cfg.DryRun, auth)
}
} else {
// sync whole index
// sync whole index if possible, otherwise sync singular image
var isIndex bool
isIndex, err = isImageIndex(ctx, img.Source)
if err != nil {
return err
}
if isIndex {
_, err = SyncIndex(ctx, img.Source, target, cfg.DryRun, auth)
} else {
imageType = "Image"
_, err = SyncImage(ctx, img.Source, target, cfg.DryRun, auth)
}
if err != nil {
return err
Expand Down
5 changes: 2 additions & 3 deletions pkg/imagesync/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type SyncDef struct {

// Image stores image location
type Image struct {
Source string
Tag string `yaml:"tag,omitempty"`
AMD64Only bool `yaml:"amd64Only,omitempty"`
Source string
Tag string `yaml:"tag,omitempty"`
}

0 comments on commit e0ad104

Please sign in to comment.