Example #1
0
        public async Task UpdateApplicationImageVersion(
            RawDeploymentManifest manifest,
            ApplicationImage applicationImage,
            string instance,
            string targetTag
            )
        {
            var manifestInfo = await _parser.BuildDeploymentManifestInfo(manifest);

            var    key             = new DeploymentManifestInstanceKey(applicationImage, instance);
            string currentImageTag = manifestInfo.ManifestTags.GetValueOrDefault(key) ?? "n/a";

            var result = await InternalUpdateApplicationImageTag(manifest, manifestInfo, applicationImage, instance, targetTag);

            if (result == null)
            {
                return;
            }

            // this is GIT requirement: we only work with relative paths in the git repository.
            _log.LogTrace("Adding {Path} to repository git staging", result);
//            var gitFilePath = Path.Combine(relativePath, file.Name);
            // var gitFilePath = Path.GetRelativePath(context.GitRepositoryRoot.FullName, file.FullName);
            // Commands.Stage(gitRepository, gitFilePath);
            var application = GetApplicationForApplicationImage(applicationImage);

            await _deploymentManifestRepositoryService.StageChanges(manifest.Repository, new[] { result });

            await _deploymentManifestRepositoryService.Commit(
                manifest.Repository,
                $"[{application}] Updated deployment for {applicationImage.ShortRepository}; {currentImageTag} to {targetTag}"
                );
        }