Make pulling of images switchable (#178)

This commit is contained in:
Jan Röhrich
2022-04-11 16:20:36 +02:00
committed by GitHub
parent ee3c5aed75
commit bcdb90f36f
3 changed files with 19 additions and 8 deletions
+4
View File
@@ -57,6 +57,10 @@ Following are the key capabilities of this action:
<tr>
<td>imagepullsecrets </br></br>(Optional)</td>
<td>Multiline input where each line contains the name of a docker-registry secret that has already been setup within the cluster. Each of these secret names are added under imagePullSecrets field for the workloads found in the input manifest files</td>
</tr>
<tr>
<td>pull-images</br></br>(Optional)</td>
<td>Acceptable values: true/false</br>Default value: true</br>Switch whether to pull the images from the registry before deployment to find out Dockerfile's path in order to add it to the annotations</td>
</tr>
<tr>
<td>strategy </br></br>(Optional)</td>
+4
View File
@@ -15,6 +15,10 @@ inputs:
imagepullsecrets:
description: "Name of a docker-registry secret that has already been set up within the cluster. Each of these secret names are added under imagePullSecrets field for the workloads found in the input manifest files"
required: false
pull-images:
description: "Switch whether to pull the images from the registry before deployment to find out Dockerfile's path in order to add it to the annotations"
required: false
default: true
strategy:
description: "Deployment strategy to be used. Allowed values are none, canary and blue-green"
required: false
+11 -8
View File
@@ -26,14 +26,17 @@ export async function getDeploymentConfig(): Promise<DeploymentConfig> {
const imageNames = core.getInput("images").split("\n") || [];
const imageDockerfilePathMap: { [id: string]: string } = {};
//Fetching from image label if available
for (const image of imageNames) {
try {
imageDockerfilePathMap[image] = await getDockerfilePath(image);
} catch (ex) {
core.warning(
`Failed to get dockerfile path for image ${image.toString()}: ${ex} `
);
const pullImages = !(core.getInput("pull-images").toLowerCase() === "false");
if (pullImages) {
//Fetching from image label if available
for (const image of imageNames) {
try {
imageDockerfilePathMap[image] = await getDockerfilePath(image);
} catch (ex) {
core.warning(
`Failed to get dockerfile path for image ${image.toString()}: ${ex} `
);
}
}
}