Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added WIF support to ContainerStructureTestV0 pipeline task #19979

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,138 changes: 862 additions & 276 deletions Tasks/ContainerStructureTestV0/_buildConfigs/Node20/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"@types/q": "^1.0.7",
"@types/uuid": "^8.3.0",
"azure-pipelines-task-lib": "^4.1.0",
"azure-pipelines-tasks-docker-common": "2.198.1",
"azure-pipelines-tasks-utility-common": "^3.212.0",
"azure-pipelines-tool-lib": "^2.0.0-preview",
"typed-rest-client": "^1.8.9"
"azure-pipelines-tasks-docker-common": "2.226.0",
"azure-pipelines-tasks-utility-common": "^3.238.0",
"azure-pipelines-tool-lib": "^2.0.7",
"typed-rest-client": "^1.8.11"
},
"devDependencies": {
"typescript": "5.1.6"
Expand Down
17 changes: 10 additions & 7 deletions Tasks/ContainerStructureTestV0/containerregistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ import * as dockerCommandUtils from "azure-pipelines-tasks-docker-common/dockerc


export class ContainerRegistry {
constructor(registryConnection: string) {
let registryAuthenticationToken: RegistryAuthenticationToken = getDockerRegistryEndpointAuthenticationToken(registryConnection);
this.connection = new ContainerConnection();
this.connection.open(null, registryAuthenticationToken, true, false);
constructor() {
this._connection = new ContainerConnection();
}

public async open(registryConnection: string) {
let registryAuthenticationToken: RegistryAuthenticationToken = await getDockerRegistryEndpointAuthenticationToken(registryConnection);
this._connection.open(null, registryAuthenticationToken, true, false);
}

public getQualifiedImageName(repository: string, tag: string){
return `${this.connection.getQualifiedImageName(repository, true)}:${tag}`
return `${this._connection.getQualifiedImageName(repository, true)}:${tag}`;
}

public async pull(repository: string, tag: string): Promise<any> {
return new Promise<any>((resolve, reject) => {
try {
const imageName = this.getQualifiedImageName(repository, tag);
dockerCommandUtils.command(this.connection, "pull", imageName, (output: any) => {
dockerCommandUtils.command(this._connection, "pull", imageName, (output: any) => {
resolve(output);
})
} catch (error) {
Expand All @@ -28,5 +31,5 @@ export class ContainerRegistry {
});
}

private connection: ContainerConnection;
private _connection: ContainerConnection;
}
3 changes: 2 additions & 1 deletion Tasks/ContainerStructureTestV0/containerstructuretest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ async function run() {
let image;
if (endpointId) {
// Establishing registry connection and pulling the container.
let containerRegistry = new ContainerRegistry(endpointId);
let containerRegistry = new ContainerRegistry();
await containerRegistry.open(endpointId);
tl.debug(`Successfully finished docker login`);
image = `${containerRegistry.getQualifiedImageName(repository, tag)}`;
tl.debug(`Image: ${image}`);
Expand Down
Loading