Skip to content

Commit

Permalink
Warn the usage of dockerImageRegistry (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell authored Aug 8, 2023
1 parent a0bfd5c commit 9433a70
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
21 changes: 18 additions & 3 deletions extension/task/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,27 @@ async function run() {
dockerRunner.arg(['--mount', `type=bind,source=/ssh-agent,target=/ssh-agent`]);
}

let dockerImageRegistry = variables.dockerImageRegistry;
if (variables.dockerImageRegistry) {
if (dockerImageRegistry !== 'ghcr.io') { // skip known default value
tl.warning(
`
You supplied the dockerImageRegistry input but it is set to be removed.
\n
If you have a compelling enough reason why it should be retained, air your views
at https://github.com/tinglesoftware/dependabot-azure-devops/issues/736
\n
Do this before Monday, 11 September, 2023 when we intend to throw errors if the input is set or ignore it altogether.
`);
}
} else {
dockerImageRegistry = 'ghcr.io';
}

// Form the docker image based on the ecosystem (repository) and the tag e.g. tinglesoftware/dependabot-updater-nuget
// For custom/enterprise registries, prefix with the registry, e.g. contoso.azurecr.io/tinglesoftware/dependabot-updater-nuget
let dockerImage: string = `tinglesoftware/dependabot-updater-${update.packageEcosystem}:${variables.dockerImageTag}`
if (variables.dockerImageRegistry) {
dockerImage = `${variables.dockerImageRegistry}/${dockerImage}`.replace("//", "/");
}
dockerImage = `${dockerImageRegistry}/${dockerImage}`.replace("//", "/");

tl.debug(`Running docker container -> '${dockerImage}' ...`);
dockerRunner.arg(dockerImage);
Expand Down
1 change: 0 additions & 1 deletion extension/task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@
"label": "Container registry override",
"groupName": "advanced",
"helpMarkDown": "The docker registry to use when pulling the docker container used by the task if needed. By default this will use GHCR. This can be useful if the container needs to come from an internal docker registry mirror or alternative source for testing. If the mirror requires authentication add a `docker login` task before this task. Example: `contoso.azurecr.io`",
"defaultValue": "ghcr.io",
"required": false
},
{
Expand Down
4 changes: 1 addition & 3 deletions extension/task/utils/getSharedVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ export default function getSharedVariables(): ISharedVariables {
);

// Prepare variables for the docker image to use
let dockerImageRegistry: string | undefined = tl.getInput(
"dockerImageRegistry"
);
let dockerImageRegistry: string | undefined = tl.getInput("dockerImageRegistry");
let dockerImageTag: string = getDockerImageTag();

return {
Expand Down

0 comments on commit 9433a70

Please sign in to comment.