The TeamCity Data Source allows you to connect to your build pipeline to retrieve the artifacts stored.
- Set up the compilation stats as a build artifact
- Take note of the
Build configuration ID(refer to Configuring General Settings)
Note:
- If you run danger in the same as the build pipeline, you'll need to use the
MixedDataSource(TODO, currently not supported) - If you have a separate danger pipeline, ensure it is execute AFTER the build pipeline (as the build artifact needs to be available)
- The
%system.teamcity.auth.userId%and%system.teamcity.auth.password%values mentioned below are automatically created for TeamCity agents to communicate back with TeamCity server
Set up the following build parameters:
env.TC_USERwith value%system.teamcity.auth.userId%env.TC_PASSWORDwith value%system.teamcity.auth.password%env.TC_SERVER_URLwith the value of your TeamCity server (for example,https://teamcity.company.com)
In your dangerfile.js:
import { danger as wbdDanger, TeamCityDataSource } from 'webpack-bundle-delta';
const { TC_USER, TC_PASSWORD, TC_SERVER_URL } = process.env;
wbdDanger({
dataSource: new TeamCityDataSource({
buildType: 'YourBuildId' /* from the build pipeline, the value on step 2 */,
serverUrl: TC_SERVER_URL,
username: TC_USER,
password: TC_PASSWORD,
}),
baseSha: danger.github.pr.base.sha,
headSha: danger.github.pr.head.sha,
});