コード例 #1
0
 public void Execute()
 {
     ExtractBuildProperties();
     _log.Info("Processing build modules...");
     ProcessMainProject();
     ProccessModuleRef();
 }
 public void sendBuildInfo(Build buildInfo)
 {
     try
     {
         sendBuildInfo(buildInfo.ToJsonString());
         _log.Info("Build successfully deployed. Browse it in Artifactory under " + string.Format(_artifactoryUrl + BUILD_BROWSE_URL) +
                   "/" + buildInfo.name + "/" + buildInfo.number + "/" + buildInfo.started + "/");
     }
     catch (Exception ex)
     {
         _log.Error("Could not publish the build-info object: " + ex.InnerException);
         throw new Exception("Could not publish build-info", ex);
     }
 }
コード例 #3
0
        public void deploy(ArtifactoryBuild task, Build build, BuildInfoLog log) 
        {
            ArtifactoryBuildInfoClient client = new ArtifactoryBuildInfoClient(task.Url, task.User, task.Password, log);
            client.setProxy(build.deployClient);
            client.setConnectionTimeout(build.deployClient);

            try
            {
                if (task.DeployEnabled != null && task.DeployEnabled.Equals("true"))
                {
                    /* Deploy every artifacts from the Map< module.name : artifact.name > => List<DeployDetails> */
                    task.deployableArtifactBuilderMap.ToList().ForEach(entry => entry.Value.ForEach(artifact => client.deployArtifact(artifact)));
                }

                if (task.BuildInfoEnabled != null && task.BuildInfoEnabled.Equals("true"))
                {
                    //Upload Build Info json file to Artifactory
                    log.Info("Uploading build info to Artifactory...");
                    /* Send Build Info  */
                    client.sendBuildInfo(build);
                }
            }
            catch (Exception e)
            {
                log.Error("Exception has append from ArtifactoryBuildInfoClient: " + e.Message, e);
                throw new Exception("Exception has append from ArtifactoryBuildInfoClient: " + e.Message, e);
            }
            finally 
            {
                client.Dispose();
            }         
        }
コード例 #4
0
        public override bool Execute()
        {
            try
            {
                buildInfoLog = new BuildInfoLog(Log);

                //Incase the MSBuild process is up, and the global variable is still exist.
                deployableArtifactBuilderMap.Clear();

                
                //System.Diagnostics.Debugger.Launch();
                buildInfoLog.Info("Artifactory Post-Build task started");

                if (!string.IsNullOrWhiteSpace(TfsActive) && TfsActive.Equals("True"))
                {
                    buildInfoLog.Info("Running inside TFS...");
                }

                SolutionHandler solution = new SolutionHandler(this, buildInfoLog);
                solution.Execute();

                BuildDeploymentHelper buildDeploymentHelper = new BuildDeploymentHelper();
                buildDeploymentHelper.deploy(this, solution._buildInfo, buildInfoLog);

                return true;
            }
            catch (Exception ex)
            {
                buildInfoLog.Error("Exception from Artifactory Task: " + ex.Message, ex);
                /*By returning false in exception, the task will not fail the all build.*/
                throw new Exception("Exception from Artifactory Task: " + ex.Message);
                //return false;
            }
            finally 
            {
                deployableArtifactBuilderMap.Clear();
            } 
        }