await till return

This commit is contained in:
Naveenraj M
2020-03-29 20:42:47 +05:30
parent c3f01090b0
commit 3d12753e2b
4 changed files with 16 additions and 23 deletions

View File

@ -30,12 +30,12 @@ function download_archive(owner, repo, ref) {
return console.log(err);
}
console.log("The Tar file was saved!");
console.log(`Tarball Location : ${tarFile}`);
return tarFile;
});
}).catch(function (error) {
console.log(error);
});
console.log(`Tarball Location : ${tarFile}`);
return tarFile;
}
catch (error) {
core.setFailed(error.message);

View File

@ -22,19 +22,17 @@ function run() {
const repo = context.repo.repo;
const ref = context.ref;
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);
const tarBallPath = yield download_tar(owner, repo, ref);
console.log(`Tar Path for copy : ${tarBallPath}`);
const specFile = core.getInput('specFile');
console.log(`Hello ${specFile} from inside a container`);
// Get repo files from /github/workspace/
yield exec.exec('ls -la /github/workspace');
// Get repo files from /github/workspace/
yield exec.exec('ls -la ');
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
yield io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
// Get tar.gz file of release
// 1. Write API call to download tar.gz from release OR
// 2. Create tar.gz of /github/workspace to get tar of source code
const tarBallPath = yield download_tar(owner, repo, ref);
console.log(`Tar Path for copy : ${tarBallPath}`);
// Get repo files from /github/workspace/
yield exec.exec('ls -la ');
// Copy tar.gz file to /root/rpmbuild/SOURCES
// make sure the name of tar.gz is same as given in Source of spec file
yield io.cp(tarBallPath, '/root/rpmbuild/SOURCES');

View File

@ -26,14 +26,14 @@ async function download_archive(owner, repo, ref ) {
return console.log(err);
}
console.log("The Tar file was saved!");
console.log(`Tarball Location : ${tarFile}`);
return tarFile;
});
}).catch( function(error){
console.log(error);
});
console.log(`Tarball Location : ${tarFile}`);
return tarFile;
} catch (error) {
core.setFailed(error.message);

View File

@ -16,16 +16,9 @@ async function run() {
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);
const tarBallPath = await download_tar(owner, repo, ref);
console.log(`Tar Path for copy : ${tarBallPath}`);
const specFile = core.getInput('specFile');
console.log(`Hello ${specFile} from inside a container`);
// Get repo files from /github/workspace/
await exec.exec('ls -la /github/workspace');
// Get repo files from /github/workspace/
await exec.exec('ls -la ');
@ -33,8 +26,12 @@ async function run() {
await io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
// Get tar.gz file of release
// 1. Write API call to download tar.gz from release OR
// 2. Create tar.gz of /github/workspace to get tar of source code
const tarBallPath = await download_tar(owner, repo, ref);
console.log(`Tar Path for copy : ${tarBallPath}`);
// Get repo files from /github/workspace/
await exec.exec('ls -la ');
// Copy tar.gz file to /root/rpmbuild/SOURCES
// make sure the name of tar.gz is same as given in Source of spec file
@ -58,8 +55,6 @@ async function run() {
//core.setOutput("rpmPath", rpmPath)
//core.setOutput("sourceRpmPath", sourceRpmPath) // make option to upload source rpm
} catch (error) {
core.setFailed(error.message);
}