зеркало из https://github.com/Azure/k8s-actions.git
Docker Login enhancement (#11)
* Removing email input from docker-login * imagepullsecret fix * Function refactoring
This commit is contained in:
Родитель
4945a96cf4
Коммит
c1d57692a2
|
@ -13,10 +13,6 @@ inputs:
|
|||
description: 'Login Server'
|
||||
required: true
|
||||
default: 'index.docker.io'
|
||||
email:
|
||||
description: 'Email'
|
||||
required: true
|
||||
default: ''
|
||||
branding:
|
||||
color: 'green'
|
||||
runs:
|
||||
|
|
|
@ -18,13 +18,11 @@ function run() {
|
|||
let username = core.getInput('username', { required: true });
|
||||
let password = core.getInput('password', { required: true });
|
||||
let loginServer = core.getInput('loginServer', { required: true });
|
||||
let email = core.getInput('email', { required: true });
|
||||
let authenticationToken = new Buffer(`${username}:${password}`).toString('base64');
|
||||
let config = {
|
||||
"auths": {
|
||||
[loginServer]: {
|
||||
auth: authenticationToken,
|
||||
email: email
|
||||
auth: authenticationToken
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,14 +8,12 @@ async function run() {
|
|||
let username = core.getInput('username', { required: true });
|
||||
let password = core.getInput('password', { required: true });
|
||||
let loginServer = core.getInput('loginServer', { required: true });
|
||||
let email = core.getInput('email', { required: true });
|
||||
let authenticationToken = new Buffer(`${username}:${password}`).toString('base64');
|
||||
|
||||
let config = {
|
||||
"auths": {
|
||||
[loginServer]: {
|
||||
auth: authenticationToken,
|
||||
email: email
|
||||
auth: authenticationToken
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,7 @@ function setImagePullSecrets(inputObject, newImagePullSecrets) {
|
|||
}
|
||||
if (utils_1.isEqual(inputObject.kind, 'pod')) {
|
||||
if (inputObject
|
||||
&& inputObject.spec
|
||||
&& inputObject.spec.imagePullSecrets) {
|
||||
&& inputObject.spec) {
|
||||
if (newImagePullSecrets.length > 0) {
|
||||
inputObject.spec.imagePullSecrets = newImagePullSecrets;
|
||||
}
|
||||
|
@ -52,8 +51,7 @@ function setImagePullSecrets(inputObject, newImagePullSecrets) {
|
|||
&& inputObject.spec.jobTemplate
|
||||
&& inputObject.spec.jobTemplate.spec
|
||||
&& inputObject.spec.jobTemplate.spec.template
|
||||
&& inputObject.spec.jobTemplate.spec.template.spec
|
||||
&& inputObject.spec.jobTemplate.spec.template.spec.imagePullSecrets) {
|
||||
&& inputObject.spec.jobTemplate.spec.template.spec) {
|
||||
if (newImagePullSecrets.length > 0) {
|
||||
inputObject.spec.jobTemplate.spec.template.spec.imagePullSecrets = newImagePullSecrets;
|
||||
}
|
||||
|
@ -66,8 +64,7 @@ function setImagePullSecrets(inputObject, newImagePullSecrets) {
|
|||
if (inputObject
|
||||
&& inputObject.spec
|
||||
&& inputObject.spec.template
|
||||
&& inputObject.spec.template.spec
|
||||
&& inputObject.spec.template.spec.imagePullSecrets) {
|
||||
&& inputObject.spec.template.spec) {
|
||||
if (newImagePullSecrets.length > 0) {
|
||||
inputObject.spec.template.spec.imagePullSecrets = newImagePullSecrets;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ function setKubectlPath() {
|
|||
const version = core.getInput('kubect-version');
|
||||
kubectlPath = toolCache.find('kubectl', version);
|
||||
if (!kubectlPath) {
|
||||
yield installKubectl(version);
|
||||
kubectlPath = yield installKubectl(version);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -101,7 +101,7 @@ function installKubectl(version) {
|
|||
if (utils_1.isEqual(version, 'latest')) {
|
||||
version = yield kubectl_util_1.getStableKubectlVersion();
|
||||
}
|
||||
kubectlPath = yield kubectl_util_1.downloadKubectl(version);
|
||||
return yield kubectl_util_1.downloadKubectl(version);
|
||||
});
|
||||
}
|
||||
function checkClusterContext() {
|
||||
|
|
|
@ -39,8 +39,7 @@ function setImagePullSecrets(inputObject: any, newImagePullSecrets: any) {
|
|||
|
||||
if (isEqual(inputObject.kind, 'pod')) {
|
||||
if (inputObject
|
||||
&& inputObject.spec
|
||||
&& inputObject.spec.imagePullSecrets) {
|
||||
&& inputObject.spec) {
|
||||
if (newImagePullSecrets.length > 0) {
|
||||
inputObject.spec.imagePullSecrets = newImagePullSecrets;
|
||||
} else {
|
||||
|
@ -53,8 +52,7 @@ function setImagePullSecrets(inputObject: any, newImagePullSecrets: any) {
|
|||
&& inputObject.spec.jobTemplate
|
||||
&& inputObject.spec.jobTemplate.spec
|
||||
&& inputObject.spec.jobTemplate.spec.template
|
||||
&& inputObject.spec.jobTemplate.spec.template.spec
|
||||
&& inputObject.spec.jobTemplate.spec.template.spec.imagePullSecrets) {
|
||||
&& inputObject.spec.jobTemplate.spec.template.spec) {
|
||||
if (newImagePullSecrets.length > 0) {
|
||||
inputObject.spec.jobTemplate.spec.template.spec.imagePullSecrets = newImagePullSecrets;
|
||||
} else {
|
||||
|
@ -65,8 +63,7 @@ function setImagePullSecrets(inputObject: any, newImagePullSecrets: any) {
|
|||
if (inputObject
|
||||
&& inputObject.spec
|
||||
&& inputObject.spec.template
|
||||
&& inputObject.spec.template.spec
|
||||
&& inputObject.spec.template.spec.imagePullSecrets) {
|
||||
&& inputObject.spec.template.spec) {
|
||||
if (newImagePullSecrets.length > 0) {
|
||||
inputObject.spec.template.spec.imagePullSecrets = newImagePullSecrets;
|
||||
} else {
|
||||
|
|
|
@ -18,7 +18,7 @@ async function setKubectlPath() {
|
|||
const version = core.getInput('kubect-version');
|
||||
kubectlPath = toolCache.find('kubectl', version);
|
||||
if (!kubectlPath) {
|
||||
await installKubectl(version);
|
||||
kubectlPath = await installKubectl(version);
|
||||
}
|
||||
} else {
|
||||
kubectlPath = await io.which('kubectl', false);
|
||||
|
@ -96,7 +96,7 @@ async function installKubectl(version: string) {
|
|||
if (isEqual(version, 'latest')) {
|
||||
version = await getStableKubectlVersion();
|
||||
}
|
||||
kubectlPath = await downloadKubectl(version);
|
||||
return await downloadKubectl(version);
|
||||
}
|
||||
|
||||
function checkClusterContext() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче