Esempio n. 1
0
        public static PackageDeploymentData Create(IOperationExecutionContext context, ILogSink log, string description)
        {
            string baseUrl = SDK.BaseUrl;

            if (string.IsNullOrEmpty(baseUrl))
            {
                log.LogDebug("Deployment will not be recorded in ProGet because the System.BaseUrl configuration setting is not set.");
                return(null);
            }

            string serverName = AH.CoalesceString(context?.ServerName, Environment.MachineName);
            string relativeUrl;

            if (SDK.ProductName == "BuildMaster")
            {
                relativeUrl = context.ExpandVariables($"applications/{((IStandardContext)context).ProjectId}/builds/build?releaseNumber=$UrlEncode($ReleaseNumber)&buildNumber=$UrlEncode($PackageNumber)").AsString();
            }
            else if (SDK.ProductName == "Hedgehog")
            {
                relativeUrl = "deployment-sets/details?deploymentSetId=" + ((IStandardContext)context).DeploymentSetId;
            }
            else
            {
                relativeUrl = "executions/execution-in-progress?executionId=" + context.ExecutionId;
            }

            return(new PackageDeploymentData(SDK.ProductName, baseUrl, relativeUrl, serverName, description));
        }