Skip to content

Commit

Permalink
fix: artifact subdir error when using volumeMount (#12638)
Browse files Browse the repository at this point in the history
  • Loading branch information
tczhao committed Feb 8, 2024
1 parent 873d3de commit 6c8a715
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 @@ -710,6 +710,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 6c8a715

Please sign in to comment.