actions / actions/runner-container-hooks

kubernetes-novolume - container step state is not copied before deletion

Open
#302 0 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
153
Forks
112
Avg merge
6m
Merged PRs (30d)
1

Description

Summary

Hello, I am currently experimenting with the new kubernetes-novolume mode and while evaluating our different use cases, I noticed that there is no logic to copy the final workspace state of a container step before deleting the pod running it.

Is it an expected breaking change with this new approach ? In the v0.7.0, the updates done by a container step to the workspace are available to the following steps running the main job pod.

Example

jobs:
  job1:
    runs-on: self-hosted
    container:
      image: xxx

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      # Add a foo.txt file in the workspace folder
      - name: Do something in container
        uses: docker://xxx

      # Read the foo.txt file > file not found
      - name: Read file foo.txt
        run: |
          cat foo.txt
        shell: bash

Investigation

I found the following code during my investigation. Is it expected that after running execPodStep, the pod is directly deleted for the container step case ?

// run-container-step.ts

l90 => await execCpFromPod(getJobPodName(), `/__w`, `${runnerWorkspace}`)
l92 => writeContainerStepScript()
l100 => execCpToPod(podName, `${runnerWorkspace}/__w`, '/__w')
l106 => execPodStep(
        ['/__e/sh', '-e', containerPath],
        pod.metadata.name,
        JOB_CONTAINER_NAME
      )
l122 => await deletePod(podName)
// run-script-step.ts

l27 => await execCpToPod(state.jobPod, runnerTemp, containerTemp)
l33 => await execPodStep(
      [args.entryPoint, ...args.entryPointArgs],
      state.jobPod,
      JOB_CONTAINER_NAME
    )
l54 => await execCpFromPod(state.jobPod, containerTemp, workdir)

Thank you in advance for your support!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing run-container-step.ts with run-script-step.ts, focusing on the workspace copy operations around execPodStep and pod deletion. Reproduce the YAML example to verify the workspace state before and after the container step; done means a file created there is available to the following job step in kubernetes-novolume mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, typescript
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.