mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-16 21:03:43 +00:00
fix: misc improvements (#1415)
- Stop overwriting the image's `ImageOS`. `ubuntu-latest` got `ubuntu20` on the 24.04 default image. - Derive `ImageOS` from `os-release` when the image sets none. Fall back to `ubuntu24` for `ubuntu-latest`. - Keep an `ImageOS` set in the job, step or container env. - Honor the image's `ImageOS` on Kubernetes. - Treat steps after a job timeout as cancelled. `cancelled()` and `always()` cleanup now runs. The job still fails. - Record nested reusable workflow results. Jobs that `needs:` a nested call now run. - Forward outputs through nested reusable workflows. A bad output fails the call. - Pass the job's `GITHUB_TOKEN` and `GITEA_TOKEN` to called workflows by default. An explicit mapping overrides them. - Probe a started container's uid and gid concurrently. - Cache the Docker container env from its first inspect. - Check `ImageOS` in the Kubernetes e2e test. --------- Co-authored-by: bircni <[email protected]> Reviewed-on: https://gitea.com/gitea/runner/pulls/1415 Reviewed-by: bircni <[email protected]> Co-authored-by: silverwind <[email protected]>
This commit is contained in:
1 parent
1f2ea1b83a
commit
0e4c8b6b78
18 files changed
+225
-56
No files matched your search
@@ -45,14 +45,15 @@ func TestDockerEnvironmentUsesContainerPath(t *testing.T) {
|
||||
Return(mobyclient.ContainerInspectResult{Container: container.InspectResponse{Config: &container.Config{Env: []string{
|
||||
"PATH=/opt/node/x64/bin:/usr/bin:/bin", "CONFLICT_VAR=container-value", "SOME_RANDOM_VAR=",
|
||||
"ANOTHER_ONE=old-value", "ANOTHER_ONE=BUT_I_HAVE_VALUE", "LITERAL='quoted'=$HOME\nsecond line",
|
||||
}}}}, nil)
|
||||
}}}}, nil).Once()
|
||||
env := map[string]string{
|
||||
"PATH": "/custom/bin",
|
||||
"RANDOM_VAR": "WITH_VALUE",
|
||||
"ANOTHER_VAR": "",
|
||||
"CONFLICT_VAR": "step-value",
|
||||
}
|
||||
require.NoError(t, (&containerReference{cli: client, id: "amd64-job"}).UpdateFromImageEnv(&env)(t.Context()))
|
||||
cr := &containerReference{cli: client, id: "amd64-job"}
|
||||
require.NoError(t, cr.UpdateFromImageEnv(&env)(t.Context()))
|
||||
assert.Equal(t, map[string]string{
|
||||
"PATH": "/custom/bin:/opt/node/x64/bin:/usr/bin:/bin",
|
||||
"RANDOM_VAR": "WITH_VALUE",
|
||||
@@ -62,6 +63,10 @@ func TestDockerEnvironmentUsesContainerPath(t *testing.T) {
|
||||
"CONFLICT_VAR": "step-value",
|
||||
"LITERAL": "'quoted'=$HOME\nsecond line",
|
||||
}, env)
|
||||
pathEnv := map[string]string{}
|
||||
require.NoError(t, cr.UpdateFromImageEnv(&pathEnv)(t.Context()))
|
||||
assert.Equal(t, "/opt/node/x64/bin:/usr/bin:/bin", pathEnv["PATH"])
|
||||
client.AssertExpectations(t)
|
||||
}
|
||||
|
||||
type mockDockerClient struct {
|
||||
|
||||
Reference in new issue
Block a user