Add container create page from the containers list with always-pull.
Release rolling / release (push) Successful in 8m24s
Release rolling / release (push) Successful in 8m24s
Adds a dedicated blank create form (name, image, always pull, ports, auto-remove, advanced settings) separate from template Deploy, reuses deployContainer with pull-if-missing and publish-all-ports support.
This commit is contained in:
+18
-4
@@ -345,11 +345,16 @@ export async function deployContainerWithSteps(args) {
|
||||
/** @type {{ pulledOk: boolean }} */
|
||||
const state = { pulledOk: false }
|
||||
const replace = args.replace === true
|
||||
const fromAdd = args.source === 'add-container'
|
||||
const alwaysPull = args.alwaysPull !== false
|
||||
const jobLabel = replace
|
||||
? `Replace ${args.containerName || 'container'}`
|
||||
: fromAdd
|
||||
? `Create ${args.containerName || 'container'}`
|
||||
: `Deploy ${args.containerName || 'container'}`
|
||||
|
||||
return runJob(
|
||||
replace
|
||||
? `Replace ${args.containerName || 'container'}`
|
||||
: `Deploy ${args.containerName || 'container'}`,
|
||||
jobLabel,
|
||||
[
|
||||
{
|
||||
id: 'validate',
|
||||
@@ -362,7 +367,9 @@ export async function deployContainerWithSteps(args) {
|
||||
}
|
||||
log(`Name=${args.containerName}`)
|
||||
log(`Image=${args.image}`)
|
||||
log(`Always pull image: ${alwaysPull ? 'yes' : 'no (local if present)'}`)
|
||||
if (replace) log('Mode: replace existing container with same name')
|
||||
if (args.publishAllPorts) log('Publish all exposed ports: yes')
|
||||
if (args.ports?.length) log(`Ports: ${args.ports.join(', ')}`)
|
||||
if (args.volumes?.length) log(`Volumes: ${args.volumes.join(', ')}`)
|
||||
if (args.networkMode) log(`Network mode: ${args.networkMode}`)
|
||||
@@ -371,13 +378,19 @@ export async function deployContainerWithSteps(args) {
|
||||
},
|
||||
{
|
||||
id: 'pull',
|
||||
label: 'Pull image (if needed)',
|
||||
label: alwaysPull ? 'Pull image' : 'Resolve image (local or pull)',
|
||||
run: async ({ log }) => {
|
||||
if (args.skipPull) {
|
||||
log('Skip pull (using local image)')
|
||||
state.pulledOk = true
|
||||
return
|
||||
}
|
||||
// alwaysPull=false: let the server decide (local if present, else pull)
|
||||
if (!alwaysPull) {
|
||||
log('Always pull is off — server will use a local image if available')
|
||||
state.pulledOk = false
|
||||
return
|
||||
}
|
||||
log(`Pulling ${args.image}…`)
|
||||
try {
|
||||
await manager.request(Methods.pullImage, { image: args.image })
|
||||
@@ -406,6 +419,7 @@ export async function deployContainerWithSteps(args) {
|
||||
const payload = {
|
||||
...args,
|
||||
skipPull: state.pulledOk === true,
|
||||
alwaysPull,
|
||||
replace: replace === true,
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user