Skip to content

bugfix: Clean docker container before use to prevent packaging failures #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class PkgPyFuncs {
});

const info = _.map(functions, (target) => {


return {
name: target.name,
includes: target.package.include,
Expand Down Expand Up @@ -122,7 +120,8 @@ class PkgPyFuncs {
if (this.abortOnPackagingErrors){
const countErrorNewLines = errorText.split('\n').length

if(countErrorNewLines < 2 && errorText.toLowerCase().includes('git clone')){

if(!errorText.includes("ERROR:") && countErrorNewLines < 2 && errorText.toLowerCase().includes('git clone')){
// Ignore false positive due to pip git clone printing to stderr
} else if(errorText.toLowerCase().includes('warning') && !errorText.toLowerCase().includes('error')){
// Ignore warnings
Expand Down Expand Up @@ -162,17 +161,19 @@ class PkgPyFuncs {

if ( out === this.containerName ){
this.log('Container already exists. Reusing.')
} else {
let args = ['run', '--rm', '-dt', '-v', `${process.cwd()}:${this.dockerServicePath}`]

if (this.mountSSH) {
args = args.concat(['-v', `${process.env.HOME}/.ssh:/root/.ssh`])
}
let out = this.runProcess('docker', ['kill', `${this.containerName}`])
this.log(out)
}

let args = ['run', '--rm', '-dt', '-v', `${process.cwd()}:${this.dockerServicePath}`]

args = args.concat(['--name',this.containerName, this.dockerImage, 'bash'])
this.runProcess('docker', args)
this.log('Container created')
if (this.mountSSH) {
args = args.concat(['-v', `${process.env.HOME}/.ssh:/root/.ssh`])
}

args = args.concat(['--name',this.containerName, this.dockerImage, 'bash'])
this.runProcess('docker', args)
this.log('Container created')
}

ensureImage(){
Expand Down Expand Up @@ -213,7 +214,7 @@ class PkgPyFuncs {
if (this.globalRequirements){
requirements = _.concat(requirements, this.globalRequirements)
}
_.forEach(requirements, (req) => { this.installRequirements(buildPath,req)})
_.forEach(requirements, (req) => { this.installRequirements(buildPath,req) })
zipper.sync.zip(buildPath).compress().save(`${buildPath}.zip`)
}

Expand Down