Skip to content

Commit

Permalink
docker L0 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nidabas committed Nov 14, 2019
1 parent ae83757 commit 6f1a7b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
22 changes: 3 additions & 19 deletions Tasks/DockerV2/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,35 +568,19 @@ describe("DockerV2 Suite", function () {
done();
});

it("getDefaultLabels returns all labels when addPipelineData is true", (done: MochaDone) => {
console.log("TestCaseName: getDefaultLabels returns all labels when addPipelineData is true");
it("getDefaultLabels returns all labels when", (done: MochaDone) => {
console.log("TestCaseName: getDefaultLabels returns all labels");
console.log("\n");

setEnvironmentVariables();
process.env['SYSTEM_HOSTTYPE'] = 'build';
const labels = pipelineutils.getDefaultLabels(true);
const labels = pipelineutils.getDefaultLabels();

// update the label count in assert when newer labels are added
assert.equal(labels.length, 9, "All labels are returned by default");
done();
});

// it("Runs successfully for docker build selected labels when addPipelineData is false", (done: MochaDone) => {
// let tp = path.join(__dirname, 'TestSetup.js');
// process.env[shared.TestEnvVars.containerRegistry] = "dockerhubendpoint";
// process.env[shared.TestEnvVars.repository] = "testuser/testrepo";
// process.env[shared.TestEnvVars.command] = shared.CommandTypes.build;
// process.env[shared.TestEnvVars.addPipelineData] = "false";
// let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
// tr.run();

// assert(tr.invokedToolCount == 1, 'should have invoked tool one time. actual: ' + tr.invokedToolCount);
// assert(tr.stderr.length == 0 || tr.errorIssues.length, 'should not have written to stderr');
// assert(tr.succeeded, 'task should have succeeded');
// assert(tr.stdout.indexOf(`[command]docker build -f ${shared.formatPath("a/w/Dockerfile")} ${shared.DockerCommandArgs.BuildLabelsWithAddPipelineFalse} -t testuser/testrepo:11 ${shared.formatPath("a/w")}`) != -1, "docker build should run with expected arguments");
// done();
// });

function setEnvironmentVariables() : void {
process.env['SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'] = 'https://mock.ms/mock/';
process.env['BUILD_SOURCEVERSION'] = 'buildId';
Expand Down
3 changes: 1 addition & 2 deletions Tasks/DockerV2/dockerbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export function run(connection: ContainerConnection, outputUpdate: (data: string
imageNames = connection.getQualifiedImageNamesFromConfig(repositoryName, true);
}

const addPipelineData = tl.getBoolInput("addPipelineData");
// get label arguments
let labelArguments = pipelineUtils.getDefaultLabels(addPipelineData);
let labelArguments = pipelineUtils.getDefaultLabels();

// get tags input
let tags = tl.getDelimitedInput("tags", "\n");
Expand Down

0 comments on commit 6f1a7b3

Please sign in to comment.