Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Docker Login enhancement (#11)
Browse files Browse the repository at this point in the history
* Removing email input from docker-login

* imagepullsecret fix

* Function refactoring
  • Loading branch information
thesattiraju committed Jul 30, 2019
1 parent 4945a96 commit c1d5769
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 26 deletions.
4 changes: 0 additions & 4 deletions docker-login/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ inputs:
description: 'Login Server'
required: true
default: 'index.docker.io'
email:
description: 'Email'
required: true
default: ''
branding:
color: 'green'
runs:
Expand Down
4 changes: 1 addition & 3 deletions docker-login/lib/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
};
Expand Down
4 changes: 1 addition & 3 deletions docker-login/src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions k8s-deploy/lib/kubernetes-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions k8s-deploy/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down
9 changes: 3 additions & 6 deletions k8s-deploy/src/kubernetes-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions k8s-deploy/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit c1d5769

Please sign in to comment.