Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix per-step test result dir handling #923

Merged
merged 1 commit into from
Mar 18, 2024
Merged

Conversation

ofalvai
Copy link
Contributor

@ofalvai ofalvai commented Mar 15, 2024

Checklist

Version

Requires a MAJOR/MINOR/PATCH version update

Context

When running in agent mode with a configured cleanup, this error happens:

Failed to create test result dir, error: stat /opt/bitrise/app-059dfbc7-01c7-4fe5-9e8d-56edac26ef83/build-e7963020-451e-4cde-9b32-09be5de1a73a/test_results: no such file or directory

This is caused by not making sure that the parent dir exists before calling os.MkdirTemp() on it: https://cs.opensource.google/go/go/+/refs/tags/go1.22.0:src/os/tempfile.go;l=108

Changes

Investigation details

Decisions

@@ -836,16 +836,25 @@ func (r WorkflowRunner) activateAndRunSteps(
"BITRISE_STEP_SOURCE_DIR": stepDir,
})

// ensure a new testDirPath and if created successfuly then attach it to the step process by and env
testDirPath, err := ioutil.TempDir(os.Getenv(configs.BitriseTestDeployDirEnvKey), "test_result")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ioutil.TempDir() is deprecated and calls os.Mkdir() directly since Go 1.17

@ofalvai ofalvai merged commit ad48e5a into master Mar 18, 2024
5 checks passed
@ofalvai ofalvai deleted the BE-1352-fix-test-dir-handling branch March 18, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants