Skip to content

Commit

Permalink
fix: artifact subdir error when using volumeMount (argoproj#12638)
Browse files Browse the repository at this point in the history
Signed-off-by: Isitha Subasinghe <[email protected]>
  • Loading branch information
tczhao authored and isubasinghe committed Feb 28, 2024
1 parent 93f0b6e commit 636f79a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/e2e/artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,44 @@ spec:
WaitForWorkflow(fixtures.ToBeSucceeded)
}

func (s *ArtifactsSuite) TestArtifactEphemeralVolume() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-volume-claim-
spec:
entrypoint: artifact-volume-claim
volumeClaimTemplates:
- metadata:
name: vol
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Mi
templates:
- name: artifact-volume-claim
inputs:
artifacts:
- name: artifact-volume-claim
path: /tmp/input/input.txt
raw:
data: abc
container:
image: argoproj/argosay:v2
command: [sh, -c]
args: ["ls -l"]
workingDir: /tmp
volumeMounts:
- name: vol
mountPath: /tmp
`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeSucceeded)
}

func TestArtifactsSuite(t *testing.T) {
suite.Run(t, new(ArtifactsSuite))
}
5 changes: 5 additions & 0 deletions workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ func (we *WorkflowExecutor) LoadArtifacts(ctx context.Context) error {
// the file is a tarball or not. If it is, it is first extracted then renamed to
// the desired location. If not, it is simply renamed to the location.
tempArtPath := artPath + ".tmp"
// Ensure parent directory exist, create if missing
tempArtDir := filepath.Dir(tempArtPath)
if err := os.MkdirAll(tempArtDir, 0o700); err != nil {
return fmt.Errorf("failed to create artifact temporary parent directory %s: %w", tempArtDir, err)
}
err = artDriver.Load(driverArt, tempArtPath)
if err != nil {
if art.Optional && argoerrs.IsCode(argoerrs.CodeNotFound, err) {
Expand Down

0 comments on commit 636f79a

Please sign in to comment.