jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-68955] Implement .inside{} wrapper for Container object
- Dominant language
- Java
- Stars
- 527
- Forks
- 422
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
Currently the workflow described in docs is something like this:
docker.image('alpine').inside {
sh 'X'
sh 'Y'
}
It does not address the situations when you need to:
- run X in container
- run Y in host agent
- run Z in the same container, preserving changes from 1
The only solution to that, AFAIK, is something like this:
docker.image('alpine').withRun { container ->
sh "docker exec ${container.id} X"
sh "Y"
sh "docker exec ${container.id} Z"
}
As mentioned in JENKINS-39746 , this is kinda ugly, even if it could be rewritten as container.exec("X").
It would be nice to have the ability to use .inside{...} not only on Image objects (source), but also on Container objects, to allow workflow like this:
docker.image('alpine').withRun { container ->
container.inside {
sh "X"
}
sh "Y"
container.inside {
sh "Z"
}
}
---
Originally reported by
artalus, imported from: Implement .inside{} wrapper for Container object
Raw content of original issue
Currently the workflow described in docs is something like this:
docker.image('alpine').inside {
sh 'X'
sh 'Y'
}It does not address the situations when you need to:
- run X in container
- run Y in host agent
- run Z in the same container, preserving changes from 1
The only solution to that, AFAIK, is something like this:
docker.image('alpine').withRun { container ->
sh "docker exec ${container.id} X"
sh "Y"
sh "docker exec ${container.id} Z"
}As mentioned in JENKINS-39746 , this is kinda ugly, even if it could be rewritten as container.exec("X").
It would be nice to have the ability to use .inside{...} not only on Image objects (source), but also on Container objects, to allow workflow like this:
docker.image('alpine').withRun { container ->
container.inside {
sh "X"
}
sh "Y"
container.inside {
sh "Z"
}
}
Contributor guide
Assessment
This issue has not been assessed yet.