1
0
Fork 0

Setup Shared Parameters for Builds

Since there is limited access to parameters in the early stages of a build we need to pass through the shared parameters from the server to the agent. Once the BuildContext has these parameters we can then go forward and check all the required information is present before trying to patch in our revision changes.
This commit is contained in:
Steven Cooney 2019-06-03 17:14:07 +01:00
parent 82aa3d1405
commit 7172047135
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,22 @@
package uk.xlab.teamcity.phabricator;
import java.util.Map;
import jetbrains.buildServer.serverSide.BuildStartContext;
import jetbrains.buildServer.serverSide.BuildStartContextProcessor;
public class PhabricatorBuildStartContextProcessor implements BuildStartContextProcessor {
@Override
public void updateParameters(BuildStartContext context) {
// Get build parameters and put them in a shared location for access on the
// agent
Map<String, String> parameters = context.getBuild().getBuildOwnParameters();
context.addSharedParameter(Constants.BRANCH_NAME, parameters.get(Constants.BRANCH_NAME));
context.addSharedParameter(Constants.BUILD_ID, parameters.get(Constants.BUILD_ID));
context.addSharedParameter(Constants.DIFF_ID, parameters.get(Constants.DIFF_ID));
context.addSharedParameter(Constants.HARBORMASTER_PHID, parameters.get(Constants.HARBORMASTER_PHID));
context.addSharedParameter(Constants.REVISION_ID, parameters.get(Constants.REVISION_ID));
}
}

View file

@ -7,4 +7,5 @@
<bean class="uk.xlab.teamcity.phabricator.PhabricatorPluginBuildFeature" /> <bean class="uk.xlab.teamcity.phabricator.PhabricatorPluginBuildFeature" />
<bean class="uk.xlab.teamcity.phabricator.PhabricatorServerLogger" /> <bean class="uk.xlab.teamcity.phabricator.PhabricatorServerLogger" />
<bean class="uk.xlab.teamcity.phabricator.PhabricatorBuildServerAdapter" /> <bean class="uk.xlab.teamcity.phabricator.PhabricatorBuildServerAdapter" />
<bean class="uk.xlab.teamcity.phabricator.PhabricatorBuildStartContextProcessor" />
</beans> </beans>