예제 #1
0
        public override Task ExecuteAsync()
        {
            Logger.WriteHeading("COPING IMAGES");

            IEnumerable <TagInfo> platformTags = Manifest.ActiveImages
                                                 .SelectMany(image => image.ActivePlatforms)
                                                 .SelectMany(platform => platform.Tags)
                                                 .ToArray();

            Logger.WriteHeading("PULLING SOURCE IMAGES");
            DockerHelper.ExecuteWithUser(
                () =>
            {
                foreach (TagInfo platformTag in platformTags)
                {
                    string sourceImage = $"{Options.SourceRepo}:{platformTag.Name}";
                    ExecuteHelper.ExecuteWithRetry("docker", $"pull {sourceImage}", Options.IsDryRun);
                    ExecuteHelper.ExecuteWithRetry("docker", $"tag {sourceImage} {platformTag.FullyQualifiedName}", Options.IsDryRun);
                }
            },
                Options.SourceUsername,
                Options.SourcePassword,
                Options.SourceServer,
                Options.IsDryRun);

            Logger.WriteHeading("PUSHING IMAGES TO DESTINATION");
            DockerHelper.ExecuteWithUser(
                () =>
            {
                foreach (TagInfo platformTag in platformTags)
                {
                    ExecuteHelper.ExecuteWithRetry("docker", $"push {platformTag.FullyQualifiedName}", Options.IsDryRun);
                }
            },
                Options.DestinationUsername,
                Options.DestinationPassword,
                Options.DestinationServer,
                Options.IsDryRun);

            return(Task.CompletedTask);
        }
예제 #2
0
 protected void ExecuteWithUser(Action action)
 {
     DockerHelper.ExecuteWithUser(action, Options.Username, Options.Password, Manifest.Registry, Options.IsDryRun);
 }
예제 #3
0
 protected void ExecuteWithUser(Action action)
 {
     DockerHelper.ExecuteWithUser(action, Options.Username, Options.Password, Options.Server, Options.IsDryRun);
 }