Description of problem:
I get synchronization error in fully disconnected environment when i synchronize two time with the target mirror and there no change / diff between first synchronization and second. The first time synchronization works, on second synchronization there is an error and exit code -1.
This case occurs when you want synchronize your disconnected registry regularly and there is no change between two synchronization.
This case is presented hereafter:
https://docs.openshift.com/container-platform/4.11/installing/disconnected_install/installing-mirroring-disconnected.html#oc-mirror-differential-updates_installing-mirroring-disconnected
In documentation we have:
« Like this, the desired mirror content can be declared in the imageset configuration file statically while the mirror jobs are executed regularly, for example as part of a cron job. This way, the mirror can be kept up to date in an automated fashion”
The main question is how to synchronize fully disconnected registry regularly (with no change between each synchronization) without returning error.
Version-Release number of selected component (if applicable):
oc-mirror 4.11
How reproducible:
Follow https://docs.openshift.com/container-platform/4.11/installing/disconnected_install/installing-mirroring-disconnected.html#mirroring-image-set-full and synchronize two time with target mirror.
Steps to Reproduce:
1. oc-mirror --from=output-dir/mirror_seq1_000000.tar docker://quay-server.example.com/foo --dest-skip-tls 2. oc-mirror --from=output-dir/mirror_seq1_000000.tar docker://quay-server.example.com/foo --dest-skip-tls
Actual results:
oc-mirror --from=output-dir/mirror_seq1_000000.tar docker://quay-server.example.com/foo --dest-skip-tls Checking push permissions for quay-server.example.com Publishing image set from archive "output-dir/mirror_seq1_000000.tar" to registry "quay-server.example.com" error: error during publishing, expecting imageset with prefix mirror_seq2: invalid mirror sequence order, want 2, got 1 => return -1
Expected results:
oc-mirror --from=output-dir/mirror_seq1_000000.tar docker://quay-server.example.com/foo --dest-skip-tls ... No diff from last synchronization, nothing to do => return 0
Additional info:
Error is trigered in pkg/cli/mirror/sequence.go
+ default: + // Complete metadata checks + // UUID mismatch will now be seen as a new workspace. + klog.V(3).Info("Checking metadata sequence number") + currRun := current.PastMirror + incomingRun := incoming.PastMirror + if incomingRun.Sequence != (currRun.Sequence + 1) { + return &ErrInvalidSequence{currRun.Sequence + 1, incomingRun.Sequence} + }
Error management in ./pkg/cli/mirror/mirror.go may be warning, no difference and return 0 instead of -1.
} case diskToMirror: dir, err := o.createResultsDir() if err != nil { return err } o.OutputDir = dir // Publish from disk to registry // this takes care of syncing the metadata to the // registry backends. mapping, err = o.Publish(ctx) if err != nil { serr := &ErrInvalidSequence{} if errors.As(err, &serr) { return fmt.Errorf("error during publishing, expecting imageset with prefix mirror_seq%d: %v", serr.wantSeq, err) } return err }