Add persistent job claim and file artifact reads
This commit is contained in:
@@ -101,6 +101,21 @@ func (executor *FileExecutor) scopeForAssignment(assignment protocol.RunJobAssig
|
||||
return scope, false, err
|
||||
}
|
||||
|
||||
func (executor *FileExecutor) existingReadTargetForAssignment(assignment protocol.RunJobAssignment) (string, string, bool, error) {
|
||||
scope, deploymentRoot, err := executor.scopeForAssignment(assignment)
|
||||
if err != nil {
|
||||
return "", "", false, err
|
||||
}
|
||||
targetKey := assignment.TargetKey
|
||||
if deploymentRoot {
|
||||
targetKey = deploymentTargetKey(targetKey)
|
||||
filePath, err := existingDeploymentTarget(scope, targetKey)
|
||||
return scope, filePath, deploymentRoot, err
|
||||
}
|
||||
filePath, err := executor.resolver.ExistingTarget(scope, targetKey)
|
||||
return scope, filePath, deploymentRoot, err
|
||||
}
|
||||
|
||||
type fileListEntry struct {
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
@@ -175,11 +190,12 @@ func (executor *FileExecutor) list(ctx context.Context, scope string, deployment
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logicalKey := path.Join(directoryKey, rel)
|
||||
entryRelativePath := rel
|
||||
if relativePath != "." {
|
||||
logicalKey = path.Join(directoryKey, relativePath, rel)
|
||||
entryRelativePath = path.Join(relativePath, rel)
|
||||
}
|
||||
candidate := append(entries, fileListEntry{Name: name, Kind: kind, RelativePath: rel, LogicalKey: logicalKey, SizeBytes: entryInfo.Size(), ModifiedAt: entryInfo.ModTime().UTC().Format(time.RFC3339Nano)})
|
||||
logicalKey := path.Join(directoryKey, entryRelativePath)
|
||||
candidate := append(entries, fileListEntry{Name: name, Kind: kind, RelativePath: entryRelativePath, LogicalKey: logicalKey, SizeBytes: entryInfo.Size(), ModifiedAt: entryInfo.ModTime().UTC().Format(time.RFC3339Nano)})
|
||||
body, marshalErr := json.Marshal(fileListEnvelope{DirectoryKey: directoryKey, Path: strings.TrimPrefix(relativePath, "."), Entries: candidate})
|
||||
if marshalErr != nil {
|
||||
return marshalErr
|
||||
|
||||
Reference in New Issue
Block a user