Example #1
0
        public GSDContext(ITracer tracer, PhysicalFileSystem fileSystem, GitRepo repository, GSDEnlistment enlistment)
        {
            this.Tracer     = tracer;
            this.FileSystem = fileSystem;
            this.Enlistment = enlistment;
            this.Repository = repository;

            this.Unattended = GSDEnlistment.IsUnattended(this.Tracer);
        }
        private bool TryRunInstallerForAsset(string assetId, out int installerExitCode, out string error)
        {
            error             = null;
            installerExitCode = 0;

            bool   installerIsRun = false;
            string path;
            string installerArgs;

            if (this.TryGetLocalInstallerPath(assetId, out path, out installerArgs))
            {
                if (!this.dryRun)
                {
                    string logFilePath = GSDEnlistment.GetNewLogFileName(
                        ProductUpgraderInfo.GetLogDirectoryPath(),
                        Path.GetFileNameWithoutExtension(path),
                        this.UpgradeInstanceId,
                        this.fileSystem);

                    string args     = installerArgs + " /Log=" + logFilePath;
                    string certCN   = null;
                    string issuerCN = null;
                    switch (assetId)
                    {
                    case GSDAssetId:
                    {
                        certCN   = GSDSigner;
                        issuerCN = GSDCertIssuer;
                        break;
                    }

                    case GitAssetId:
                    {
                        certCN   = GitSigner;
                        issuerCN = GitCertIssuer;
                        break;
                    }
                    }

                    this.RunInstaller(path, args, certCN, issuerCN, out installerExitCode, out error);

                    if (installerExitCode != 0 && string.IsNullOrEmpty(error))
                    {
                        error = assetId + " installer failed. Error log: " + logFilePath;
                    }
                }

                installerIsRun = true;
            }
            else
            {
                error = "Could not find downloaded installer for " + assetId;
            }

            return(installerIsRun);
        }
        public static bool TryGetDefaultLocalCacheRoot(GSDEnlistment enlistment, out string localCacheRoot, out string localCacheRootError)
        {
            if (GSDEnlistment.IsUnattended(tracer: null))
            {
                localCacheRoot      = Path.Combine(enlistment.DotGSDRoot, GSDConstants.DefaultGSDCacheFolderName);
                localCacheRootError = null;
                return(true);
            }

            return(GSDPlatform.Instance.TryGetDefaultLocalCacheRoot(enlistment.EnlistmentRoot, out localCacheRoot, out localCacheRootError));
        }
Example #4
0
 public void SaveCloneMetadata(ITracer tracer, GSDEnlistment enlistment)
 {
     this.repoMetadata.SetValuesAndFlush(
         new[]
     {
         new KeyValuePair <string, string>(Keys.DiskLayoutMajorVersion, GSDPlatform.Instance.DiskLayoutUpgrade.Version.CurrentMajorVersion.ToString()),
         new KeyValuePair <string, string>(Keys.DiskLayoutMinorVersion, GSDPlatform.Instance.DiskLayoutUpgrade.Version.CurrentMinorVersion.ToString()),
         new KeyValuePair <string, string>(Keys.GitObjectsRoot, enlistment.GitObjectsRoot),
         new KeyValuePair <string, string>(Keys.LocalCacheRoot, enlistment.LocalCacheRoot),
         new KeyValuePair <string, string>(Keys.BlobSizesRoot, enlistment.BlobSizesRoot),
         new KeyValuePair <string, string>(Keys.EnlistmentId, CreateNewEnlistmentId(tracer)),
     });
 }
 public LocalCacheResolver(GSDEnlistment enlistment, PhysicalFileSystem fileSystem = null)
 {
     this.fileSystem = fileSystem ?? new PhysicalFileSystem();
     this.enlistment = enlistment;
 }