ptagr
(Punit Agrawal)
May 24, 2018, 8:15pm
1
Is there a way to always pull the image (even if exists locally) when running a step?
I do see code for it but dont know how to set the “proc.Pull” variable
config := toConfig(proc)
hostConfig := toHostConfig(proc)
// create pull options with encoded authorization credentials.
pullopts := types.ImagePullOptions{}
if proc.AuthConfig.Username != "" && proc.AuthConfig.Password != "" {
pullopts.RegistryAuth, _ = encodeAuthToBase64(proc.AuthConfig)
}
// automatically pull the latest version of the image if requested
// by the process configuration.
if proc.Pull {
rc, perr := e.client.ImagePull(ctx, config.Image, pullopts)
if perr == nil {
io.Copy(ioutil.Discard, rc)
rc.Close()
}
// fix for drone/drone#1917
if perr != nil && proc.AuthConfig.Password != "" {
return perr
jhernandez
(Jorge Hernández)
May 24, 2018, 9:37pm
2
pipeline:
test:
pull: true
image: alpine
1 Like