Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented solution
With Argo Workflows 4, a task container without a
commandmakes the workflow controller read theimage's ENTRYPOINT/CMD from the registry, which needs credentials the controller doesn't have
(
failed to look-up entrypoint/cmd for image ... DENIED). Passing Argo a secret isn't portable acrossclouds, and writing a
command=for every task by hand is error-prone.harness-deploymentnow derives each task image's command from its Dockerfile and writes it to thegenerated values as
task-commands, next totask-images. At runtimeCustomTask(and so the exithandler) uses it as the default
command. The controller then sees a command in the spec and neverqueries the registry. Nothing secret is involved and nothing is cloud-specific.
task-commandsadded toHarnessMainConfig(free-form map, liketask-images).ch_cli_tools/dockerfile.py(DockerfileParser) builds a small model of the file(instructions, stages, resolved ENTRYPOINT/CMD) following Docker's rules: last ENTRYPOINT/CMD of the
final stage wins; an ENTRYPOINT clears a CMD inherited from a base but not one set earlier in the same
stage; shell form runs as
<shell> -c <raw string>withSHELLhonoured, also across project baseimages; exec form is used as written; stage names are case-insensitive.
CHDockerfilefollows project base images referenced throughARG. Dockerfiles thatlead back to themselves are reported as an error and their base is ignored.
CHProject.all_task_commands()fillstask-commands, keyed liketask-images.CloudharnessConfig.get_task_command(name)reads it.Precedence (what is written in code always wins):
command=passed to the taskcommandintemplate_overrides['container']argsintemplate_overrides['container'](no command is derived, the image's entrypoint runs)Known limits
node:20) may define its own ENTRYPOINT, which a Dockerfileparser cannot see. It is assumed to define none, and one highlighted warning names the external bases
the commands rely on. A task on such a base that sets only a CMD gets a wrong command until it sets
command=.argsoverride and nocommandstill hits the registry lookup.How to test this PR
Automated:
On a project:
harness-deploymentwith a task whose Dockerfile has a CMD and checkdeployment/helm/values.yaml:task-commandsholds its command, keyed by the task image name.command=from aCustomTaskof that project, deploy, and start the workflow.kubectl get wf <name> -o yamlshows the derivedcontainer.commandin the template, the controllerlogs no
failed to look-up, and the workflow succeeds (the exit handler too).Verified this way on a dev cluster with a real project project: two different task workflows (shell-form CMD with variables), both with the explicit command removed, ran to completion including their exit handler. The project's other workflows were not run. On HFO the derived commands equal the explicit ones for all of its tasks.
Sanity checks:
Breaking changes (select one):
breaking-changeand the migration procedure is well described abovePossible deployment updates issues (select one):
alert:deploymentTest coverage (select one):
Documentation (select one):
Nice to have (if relevant):