drGrove / drGrove/grunt-docker-io
Checking login when push is false
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
The true in the runIf function call below makes the plugin check for login every time, regardless if I want to push a container or not. This should be changed to opts.push so that it's only running if I decide I want to push. It also removes the requirement for the username and pushLocation to be present if push is set to false.
```
runIf(true, function(){
var loginOpts = ['login']
if(opts.pushLocation !== DOCKER_HUB_URL) {
loginOpts.push(opts.pushLocation)
}
var dockerLogin = spawn('docker', loginOpts)
dockerLogin.stdout.on('data', function(data){
data = data || ''
var usernameRegex = /\(.*\)/
if(usernameRegex.exec(data) && usernameRegex.exec(data).length > 0) {
if(usernameRegex.exec(data)[0] !== '(' + opts.username + ')'){
grunt.fatal('Please Login First')
}
next()
} else {
grunt.fatal('Please login to the docker registry - ' + opts.pushLocation)
}
})
})
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Search the project for the runIf(true) call shown in the issue and inspect the surrounding Docker login flow. Change the condition to use opts.push, then verify that login credentials and pushLocation are not required and Docker login is skipped when pushing is disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, javascript
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100