Skip to content

Commit 132432b

Browse files
authored
Added WIF support to ContainerStructureTestV0 pipeline task (#19979)
1 parent 1fbc6b2 commit 132432b

23 files changed

+2634
-690
lines changed

Tasks/ContainerStructureTestV0/_buildConfigs/Node20/Tests/package-lock.json

+11-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/ContainerStructureTestV0/_buildConfigs/Node20/package-lock.json

+862-276
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/ContainerStructureTestV0/_buildConfigs/Node20/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"@types/q": "^1.0.7",
2323
"@types/uuid": "^8.3.0",
2424
"azure-pipelines-task-lib": "^4.1.0",
25-
"azure-pipelines-tasks-docker-common": "2.198.1",
26-
"azure-pipelines-tasks-utility-common": "^3.212.0",
27-
"azure-pipelines-tool-lib": "^2.0.0-preview",
28-
"typed-rest-client": "^1.8.9"
25+
"azure-pipelines-tasks-docker-common": "2.226.0",
26+
"azure-pipelines-tasks-utility-common": "^3.238.0",
27+
"azure-pipelines-tool-lib": "^2.0.7",
28+
"typed-rest-client": "^1.8.11"
2929
},
3030
"devDependencies": {
3131
"typescript": "5.1.6"

Tasks/ContainerStructureTestV0/containerregistry.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@ import * as dockerCommandUtils from "azure-pipelines-tasks-docker-common/dockerc
55

66

77
export class ContainerRegistry {
8-
constructor(registryConnection: string) {
9-
let registryAuthenticationToken: RegistryAuthenticationToken = getDockerRegistryEndpointAuthenticationToken(registryConnection);
10-
this.connection = new ContainerConnection();
11-
this.connection.open(null, registryAuthenticationToken, true, false);
8+
constructor() {
9+
this._connection = new ContainerConnection();
10+
}
11+
12+
public async open(registryConnection: string) {
13+
let registryAuthenticationToken: RegistryAuthenticationToken = await getDockerRegistryEndpointAuthenticationToken(registryConnection);
14+
this._connection.open(null, registryAuthenticationToken, true, false);
1215
}
1316

1417
public getQualifiedImageName(repository: string, tag: string){
15-
return `${this.connection.getQualifiedImageName(repository, true)}:${tag}`
18+
return `${this._connection.getQualifiedImageName(repository, true)}:${tag}`;
1619
}
1720

1821
public async pull(repository: string, tag: string): Promise<any> {
1922
return new Promise<any>((resolve, reject) => {
2023
try {
2124
const imageName = this.getQualifiedImageName(repository, tag);
22-
dockerCommandUtils.command(this.connection, "pull", imageName, (output: any) => {
25+
dockerCommandUtils.command(this._connection, "pull", imageName, (output: any) => {
2326
resolve(output);
2427
})
2528
} catch (error) {
@@ -28,5 +31,5 @@ export class ContainerRegistry {
2831
});
2932
}
3033

31-
private connection: ContainerConnection;
34+
private _connection: ContainerConnection;
3235
}

Tasks/ContainerStructureTestV0/containerstructuretest.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ async function run() {
3939
let image;
4040
if (endpointId) {
4141
// Establishing registry connection and pulling the container.
42-
let containerRegistry = new ContainerRegistry(endpointId);
42+
let containerRegistry = new ContainerRegistry();
43+
await containerRegistry.open(endpointId);
4344
tl.debug(`Successfully finished docker login`);
4445
image = `${containerRegistry.getQualifiedImageName(repository, tag)}`;
4546
tl.debug(`Image: ${image}`);

0 commit comments

Comments
 (0)