Skip to content

Dynamic Jobs force "docker-image" Jobs Context to Output FolderΒ #424

@calvinmorrow

Description

@calvinmorrow

Describe the bug
Dynamic jobs created via an output to /infrabox/output/infrabox.json force future docker-image jobs to lose Git context by binding /infrabox/context to /data/repo/.infrabox/output

To Reproduce

  1. Create a dynamic job by copying an infrabox.json file to /infrabox/output/infrabox.json with a docker-image type job.
  2. Git repo is cloned like normal
  3. Git context is inaccessible because docker mounts are as follows:
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/data/repo/.infrabox",
                "Destination": "/infrabox",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/data/repo/.infrabox/output",
                "Destination": "/infrabox/context",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],

Expected behavior
Normal docker-image jobs would have context set to the git repo (/data/repo). Context is empty unless other files are copied to /infrabox/output

I am assuming this is unintended behavior. At the least it seems undocumented behavior. Context is set in job.py to the Infrabox output folder in https://github.com/SAP/InfraBox/blob/master/src/job/job.py#L445-L454.

Our use case was to write a tool that would run workflows (specific infrabox.json files) on specific branches. If the branch matched, the file was copied to /infrabox/output/infrabox.json (ie: master or release branch workflows). Unfortunately the workflows subsequently failed because the git repo was inaccessible to the dynamically created jobs.

Clarifying that this issue primarily affects docker-image jobs since in docker jobs the build_context can be changed (to ../.. in most examples I've seen) which I don't believe is possible with docker-image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions