mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
feat: show workflow name for scheduled runs (#11770)
Previously, a scheduled run would appear like a run triggered by a push. That could be confusing, especially if a scheduled run was unrelated to that particular commit. Now, either the workflow's name (taken from the field `name:`) is displayed or the path to workflow file, matching the behaviour of `workflow_dispatch`. As a side-effect, the description of all run types were improved. They are no longer pieced together from individual translations. `workflow_dispatch` also no longer misattributes commits to the user that triggered the workflow. Resolves https://codeberg.org/forgejo/forgejo/issues/11688. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests for Go changes (can be removed for JavaScript changes) - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I ran... - [x] `make pr-go` before pushing ### Tests for JavaScript changes (can be removed for Go changes) - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. *The decision if the pull request will be shown in the release notes is up to the mergers / release team.* The content of the `release-notes/<pull request number>.md` file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11770 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Co-authored-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch> Co-committed-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
This commit is contained in:
parent
5b83cb5508
commit
b01278e534
17 changed files with 407 additions and 52 deletions
|
|
@ -5,14 +5,17 @@ package integration
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/unittest"
|
||||
"forgejo.org/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestActionRunsList(t *testing.T) {
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestActionRunsList")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user5/repo4/actions")
|
||||
|
|
@ -20,7 +23,28 @@ func TestActionRunsList(t *testing.T) {
|
|||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
runSubLine := htmlDoc.Find(".run-list .flex-item-body").Text()
|
||||
assert.Contains(t, runSubLine, "Commit")
|
||||
assert.NotContains(t, runSubLine, "-Commit")
|
||||
runDescriptions := htmlDoc.Find(".run-list .flex-item-body")
|
||||
|
||||
allWhitespacePattern := regexp.MustCompile(`\s+`)
|
||||
|
||||
assert.Equal(t, 8, runDescriptions.Length())
|
||||
|
||||
assert.Contains(t, allWhitespacePattern.ReplaceAllString(runDescriptions.Eq(0).Text(), " "),
|
||||
"dispatch.yaml #210 - Run of commit dc67f0a1a0 triggered by user29")
|
||||
assert.Equal(t, "/user5/repo4/commit/dc67f0a1a0dc2417cd0b1a9f0b95e2e5d91876e9",
|
||||
runDescriptions.Eq(0).Find("a").Eq(0).AttrOr("href", ""))
|
||||
assert.Equal(t, "/user29",
|
||||
runDescriptions.Eq(0).Find("a").Eq(1).AttrOr("href", ""))
|
||||
|
||||
assert.Contains(t, allWhitespacePattern.ReplaceAllString(runDescriptions.Eq(1).Text(), " "),
|
||||
"scheduled.yaml #209 - Scheduled run of commit 64357baca8")
|
||||
assert.Equal(t, "/user5/repo4/commit/64357baca84bfff631e7dfae5a3433b26d005646",
|
||||
runDescriptions.Eq(1).Find("a").Eq(0).AttrOr("href", ""))
|
||||
|
||||
assert.Contains(t, allWhitespacePattern.ReplaceAllString(runDescriptions.Eq(2).Text(), " "),
|
||||
"test.yaml #192 - Commit c2d72f5484 pushed by user1")
|
||||
assert.Equal(t, "/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0",
|
||||
runDescriptions.Eq(2).Find("a").Eq(0).AttrOr("href", ""))
|
||||
assert.Equal(t, "/user1",
|
||||
runDescriptions.Eq(2).Find("a").Eq(1).AttrOr("href", ""))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1134,3 +1134,83 @@ func TestActionsWorkflowDispatchConcurrencyGroup(t *testing.T) {
|
|||
assert.Equal(t, actions_model.StatusCancelled, firstRunReload.Status)
|
||||
})
|
||||
}
|
||||
|
||||
func TestActionsScheduledWorkflow(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
workflowID string
|
||||
workflowDirectory string
|
||||
workflowContent string
|
||||
expectedWorkflowTitle string
|
||||
expectedCronSpecs []string
|
||||
}{
|
||||
{
|
||||
name: "GitHub",
|
||||
workflowID: "scheduled.yml",
|
||||
workflowDirectory: ".github/workflows",
|
||||
workflowContent: `
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 5,17 * * *"
|
||||
jobs:
|
||||
test:
|
||||
steps:
|
||||
- run: echo OK
|
||||
`,
|
||||
expectedWorkflowTitle: ".github/workflows/scheduled.yml",
|
||||
expectedCronSpecs: []string{"30 5,17 * * *"},
|
||||
},
|
||||
{
|
||||
name: "Gitea",
|
||||
workflowID: "test.yml",
|
||||
workflowDirectory: ".gitea/workflows",
|
||||
workflowContent: `
|
||||
name: My scheduled workflow
|
||||
on:
|
||||
schedule:
|
||||
- cron: "* * * * *"
|
||||
jobs:
|
||||
test:
|
||||
steps:
|
||||
- run: echo OK
|
||||
`,
|
||||
expectedWorkflowTitle: "My scheduled workflow",
|
||||
expectedCronSpecs: []string{"* * * * *"},
|
||||
},
|
||||
}
|
||||
onApplicationRun(t, func(t *testing.T, u *url.URL) {
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
||||
// create the repo
|
||||
repo, sha, f := tests.CreateDeclarativeRepo(t, user2, "repo-workflow-dispatch",
|
||||
[]unit_model.Type{unit_model.TypeActions}, nil,
|
||||
[]*files_service.ChangeRepoFile{
|
||||
{
|
||||
Operation: "create",
|
||||
TreePath: fmt.Sprintf("%s/%s", testCase.workflowDirectory, testCase.workflowID),
|
||||
ContentReader: strings.NewReader(testCase.workflowContent),
|
||||
},
|
||||
},
|
||||
)
|
||||
defer f()
|
||||
|
||||
schedules, err := db.Find[actions_model.ActionSchedule](t.Context(), actions_model.FindScheduleOptions{RepoID: repo.ID})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, schedules, 1)
|
||||
|
||||
assert.Equal(t, testCase.expectedWorkflowTitle, schedules[0].Title)
|
||||
assert.Equal(t, testCase.expectedCronSpecs, schedules[0].Specs)
|
||||
assert.Equal(t, repo.ID, schedules[0].RepoID)
|
||||
assert.Equal(t, repo.OwnerID, schedules[0].OwnerID)
|
||||
assert.Equal(t, testCase.workflowID, schedules[0].WorkflowID)
|
||||
assert.Equal(t, testCase.workflowDirectory, schedules[0].WorkflowDirectory)
|
||||
assert.Equal(t, int64(-2), schedules[0].TriggerUserID)
|
||||
assert.Equal(t, sha, schedules[0].CommitSHA)
|
||||
assert.Equal(t, webhook_module.HookEventPush, schedules[0].Event)
|
||||
assert.Equal(t, []byte(testCase.workflowContent), schedules[0].Content)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
|
@ -128,34 +129,77 @@ func TestActionViewsArtifactDownload(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestActionViewsView(t *testing.T) {
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestActionViewsView")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user5/repo4/actions/runs/187")
|
||||
intermediateRedirect := MakeRequest(t, req, http.StatusTemporaryRedirect)
|
||||
testCases := []struct {
|
||||
name string
|
||||
url string
|
||||
runIndex int64
|
||||
jobIndex int64
|
||||
attempt int64
|
||||
expectedJSON string
|
||||
expectedArtifacts string
|
||||
}{
|
||||
{
|
||||
name: "push",
|
||||
url: "/user5/repo4/actions/runs/187",
|
||||
runIndex: 187,
|
||||
jobIndex: 0,
|
||||
attempt: 1,
|
||||
expectedJSON: "{\"state\":{\"run\":{\"preExecutionError\":\"\",\"link\":\"/user5/repo4/actions/runs/187\",\"title\":\"update actions\",\"titleHTML\":\"update actions\",\"status\":\"success\",\"canCancel\":false,\"canApprove\":false,\"canRerun\":false,\"canDeleteArtifact\":false,\"description\":\"Commit <a href=\\\"/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0\\\">c2d72f5484</a> pushed by <a href=\\\"/user1\\\">user1</a>\",\"done\":true,\"jobs\":[{\"id\":192,\"name\":\"job_2\",\"status\":\"success\",\"canRerun\":false,\"duration\":\"_duration_\"}],\"commit\":{\"localeWorkflow\":\"Workflow\",\"localeAllRuns\":\"all runs\",\"shortSHA\":\"c2d72f5484\",\"link\":\"/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0\",\"pusher\":{\"displayName\":\"user1\",\"link\":\"/user1\"},\"branch\":{\"name\":\"master\",\"link\":\"/user5/repo4/src/branch/master\",\"isDeleted\":false}}},\"currentJob\":{\"title\":\"job_2\",\"details\":[\"Success\"],\"steps\":[{\"summary\":\"Set up job\",\"duration\":\"_duration_\",\"status\":\"success\"},{\"summary\":\"Complete job\",\"duration\":\"_duration_\",\"status\":\"success\"}],\"allAttempts\":[{\"number\":3,\"time_since_started_html\":\"_time_\",\"status\":\"running\",\"status_diagnostics\":[\"Running\"]},{\"number\":2,\"time_since_started_html\":\"_time_\",\"status\":\"success\",\"status_diagnostics\":[\"Success\"]},{\"number\":1,\"time_since_started_html\":\"_time_\",\"status\":\"success\",\"status_diagnostics\":[\"Success\"]}]}},\"logs\":{\"stepsLog\":[]}}\n",
|
||||
expectedArtifacts: "{\"artifacts\":[{\"name\":\"multi-file-download\",\"size\":2048,\"status\":\"completed\"}]}\n",
|
||||
},
|
||||
{
|
||||
name: "scheduled",
|
||||
url: "/user5/repo4/actions/runs/209",
|
||||
runIndex: 209,
|
||||
jobIndex: 0,
|
||||
attempt: 1,
|
||||
expectedJSON: "{\"state\":{\"run\":{\"link\":\"/user5/repo4/actions/runs/209\",\"title\":\"A scheduled workflow\",\"titleHTML\":\"A scheduled workflow\",\"status\":\"waiting\",\"description\":\"Scheduled run of commit \\u003ca href=\\\"/user5/repo4/commit/64357baca84bfff631e7dfae5a3433b26d005646\\\"\\u003e64357baca8\\u003c/a\\u003e\",\"canCancel\":false,\"canApprove\":false,\"canRerun\":false,\"canDeleteArtifact\":false,\"done\":false,\"jobs\":[{\"id\":2153,\"name\":\"job_2\",\"status\":\"waiting\",\"canRerun\":false,\"duration\":\"_duration_\"}],\"commit\":{\"localeWorkflow\":\"Workflow\",\"localeAllRuns\":\"all runs\",\"shortSHA\":\"64357baca8\",\"link\":\"/user5/repo4/commit/64357baca84bfff631e7dfae5a3433b26d005646\",\"pusher\":{\"displayName\":\"forgejo-actions\",\"link\":\"/forgejo-actions\"},\"branch\":{\"name\":\"master\",\"link\":\"/user5/repo4/src/branch/master\",\"isDeleted\":false}},\"preExecutionError\":\"\"},\"currentJob\":{\"title\":\"job_2\",\"details\":[\"Waiting for a runner with the following labels: debian, gpu\"],\"steps\":[{\"summary\":\"Set up job\",\"duration\":\"_duration_\",\"status\":\"success\"},{\"summary\":\"Complete job\",\"duration\":\"_duration_\",\"status\":\"success\"}],\"allAttempts\":[{\"number\":1,\"time_since_started_html\":\"-\",\"status\":\"success\",\"status_diagnostics\":[\"Success\"]}]}},\"logs\":{\"stepsLog\":[]}}\n",
|
||||
expectedArtifacts: "{\"artifacts\":[]}\n",
|
||||
},
|
||||
{
|
||||
name: "workflow_dispatch",
|
||||
url: "/user5/repo4/actions/runs/210",
|
||||
runIndex: 210,
|
||||
jobIndex: 0,
|
||||
attempt: 1,
|
||||
expectedJSON: "{\"state\":{\"run\":{\"link\":\"/user5/repo4/actions/runs/210\",\"title\":\"A triggered run\",\"titleHTML\":\"A triggered run\",\"status\":\"waiting\",\"description\":\"Run of commit \\u003ca href=\\\"/user5/repo4/commit/f4100ac14112a3740490afb22b07b69b0b5d4e8b\\\"\\u003ef4100ac141\\u003c/a\\u003e triggered by \\u003ca href=\\\"/user29\\\"\\u003euser29\\u003c/a\\u003e\",\"canCancel\":false,\"canApprove\":false,\"canRerun\":false,\"canDeleteArtifact\":false,\"done\":false,\"jobs\":[{\"id\":2154,\"name\":\"mirror\",\"status\":\"waiting\",\"canRerun\":false,\"duration\":\"_duration_\"}],\"commit\":{\"localeWorkflow\":\"Workflow\",\"localeAllRuns\":\"all runs\",\"shortSHA\":\"f4100ac141\",\"link\":\"/user5/repo4/commit/f4100ac14112a3740490afb22b07b69b0b5d4e8b\",\"pusher\":{\"displayName\":\"user29\",\"link\":\"/user29\"},\"branch\":{\"name\":\"master\",\"link\":\"/user5/repo4/src/branch/master\",\"isDeleted\":false}},\"preExecutionError\":\"\"},\"currentJob\":{\"title\":\"mirror\",\"details\":[\"Waiting for a runner with the following label: windows\"],\"steps\":[{\"summary\":\"Set up job\",\"duration\":\"_duration_\",\"status\":\"running\"},{\"summary\":\"Complete job\",\"duration\":\"_duration_\",\"status\":\"waiting\"}],\"allAttempts\":[{\"number\":1,\"time_since_started_html\":\"-\",\"status\":\"waiting\",\"status_diagnostics\":[\"Waiting for a runner with the following label: windows\"]}]}},\"logs\":{\"stepsLog\":[]}}\n",
|
||||
expectedArtifacts: "{\"artifacts\":[]}\n",
|
||||
},
|
||||
}
|
||||
|
||||
finalURL := intermediateRedirect.Result().Header.Get("Location")
|
||||
req = NewRequest(t, "GET", finalURL)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
req := NewRequest(t, "GET", testCase.url)
|
||||
intermediateRedirect := MakeRequest(t, req, http.StatusTemporaryRedirect)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
selector := "#repo-action-view"
|
||||
// Verify key properties going into the `repo-action-view` to initialize the Vue component.
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-run-index", "187")
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-job-index", "0")
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-attempt-number", "1")
|
||||
htmlDoc.AssertAttrPredicate(t, selector, "data-initial-post-response", func(actual string) bool {
|
||||
// Remove dynamic "duration" fields for comparison.
|
||||
pattern := `"duration":"[^"]*"`
|
||||
re := regexp.MustCompile(pattern)
|
||||
actualClean := re.ReplaceAllString(actual, `"duration":"_duration_"`)
|
||||
// Remove "time_since_started_html" fields for comparison since they're TZ-sensitive in the test
|
||||
pattern = `"time_since_started_html":".*?\\u003c/relative-time\\u003e"`
|
||||
re = regexp.MustCompile(pattern)
|
||||
actualClean = re.ReplaceAllString(actualClean, `"time_since_started_html":"_time_"`)
|
||||
finalURL := intermediateRedirect.Result().Header.Get("Location")
|
||||
req = NewRequest(t, "GET", finalURL)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
return assert.JSONEq(t, "{\"state\":{\"run\":{\"preExecutionError\":\"\",\"link\":\"/user5/repo4/actions/runs/187\",\"title\":\"update actions\",\"titleHTML\":\"update actions\",\"status\":\"success\",\"canCancel\":false,\"canApprove\":false,\"canRerun\":false,\"canDeleteArtifact\":false,\"done\":true,\"jobs\":[{\"id\":192,\"name\":\"job_2\",\"status\":\"success\",\"canRerun\":false,\"duration\":\"_duration_\"}],\"commit\":{\"localeCommit\":\"Commit\",\"localePushedBy\":\"pushed by\",\"localeWorkflow\":\"Workflow\",\"localeAllRuns\":\"all runs\",\"shortSHA\":\"c2d72f5484\",\"link\":\"/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0\",\"pusher\":{\"displayName\":\"user1\",\"link\":\"/user1\"},\"branch\":{\"name\":\"master\",\"link\":\"/user5/repo4/src/branch/master\",\"isDeleted\":false}}},\"currentJob\":{\"title\":\"job_2\",\"details\":[\"Success\"],\"steps\":[{\"summary\":\"Set up job\",\"duration\":\"_duration_\",\"status\":\"success\"},{\"summary\":\"Complete job\",\"duration\":\"_duration_\",\"status\":\"success\"}],\"allAttempts\":[{\"number\":3,\"time_since_started_html\":\"_time_\",\"status\":\"running\",\"status_diagnostics\":[\"Running\"]},{\"number\":2,\"time_since_started_html\":\"_time_\",\"status\":\"success\",\"status_diagnostics\":[\"Success\"]},{\"number\":1,\"time_since_started_html\":\"_time_\",\"status\":\"success\",\"status_diagnostics\":[\"Success\"]}]}},\"logs\":{\"stepsLog\":[]}}\n", actualClean)
|
||||
})
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-initial-artifacts-response", "{\"artifacts\":[{\"name\":\"multi-file-download\",\"size\":2048,\"status\":\"completed\"}]}\n")
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
selector := "#repo-action-view"
|
||||
// Verify key properties going into the `repo-action-view` to initialize the Vue component.
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-run-index", strconv.FormatInt(testCase.runIndex, 10))
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-job-index", strconv.FormatInt(testCase.jobIndex, 10))
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-attempt-number", strconv.FormatInt(testCase.attempt, 10))
|
||||
htmlDoc.AssertAttrPredicate(t, selector, "data-initial-post-response", func(actual string) bool {
|
||||
// Remove dynamic "duration" fields for comparison.
|
||||
pattern := `"duration":"[^"]*"`
|
||||
re := regexp.MustCompile(pattern)
|
||||
actualClean := re.ReplaceAllString(actual, `"duration":"_duration_"`)
|
||||
// Remove "time_since_started_html" fields for comparison since they're TZ-sensitive in the test
|
||||
pattern = `"time_since_started_html":".*?\\u003c/relative-time\\u003e"`
|
||||
re = regexp.MustCompile(pattern)
|
||||
actualClean = re.ReplaceAllString(actualClean, `"time_since_started_html":"_time_"`)
|
||||
|
||||
return assert.JSONEq(t, testCase.expectedJSON, actualClean)
|
||||
})
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-initial-artifacts-response", testCase.expectedArtifacts)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Action re-run will redirect the user to an attempt that may not exist in the database yet, since attempts are only
|
||||
|
|
@ -185,7 +229,7 @@ func TestActionViewsViewAttemptOutOfRange(t *testing.T) {
|
|||
re = regexp.MustCompile(pattern)
|
||||
actualClean = re.ReplaceAllString(actualClean, `"time_since_started_html":"_time_"`)
|
||||
|
||||
return assert.JSONEq(t, "{\"state\":{\"run\":{\"preExecutionError\":\"\",\"link\":\"/user5/repo4/actions/runs/190\",\"title\":\"job output\",\"titleHTML\":\"job output\",\"status\":\"success\",\"canCancel\":false,\"canApprove\":false,\"canRerun\":false,\"canDeleteArtifact\":false,\"done\":false,\"jobs\":[{\"id\":396,\"name\":\"job_2\",\"status\":\"waiting\",\"canRerun\":false,\"duration\":\"_duration_\"}],\"commit\":{\"localeCommit\":\"Commit\",\"localePushedBy\":\"pushed by\",\"localeWorkflow\":\"Workflow\",\"localeAllRuns\":\"all runs\",\"shortSHA\":\"c2d72f5484\",\"link\":\"/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0\",\"pusher\":{\"displayName\":\"user1\",\"link\":\"/user1\"},\"branch\":{\"name\":\"test\",\"link\":\"/user5/repo4/src/branch/test\",\"isDeleted\":true}}},\"currentJob\":{\"title\":\"job_2\",\"details\":[\"Waiting for a runner with the following label: fedora\"],\"steps\":[],\"allAttempts\":null}},\"logs\":{\"stepsLog\":[]}}\n", actualClean)
|
||||
return assert.JSONEq(t, "{\"state\":{\"run\":{\"preExecutionError\":\"\",\"link\":\"/user5/repo4/actions/runs/190\",\"title\":\"job output\",\"titleHTML\":\"job output\",\"status\":\"success\",\"canCancel\":false,\"canApprove\":false,\"canRerun\":false,\"canDeleteArtifact\":false,\"description\":\"Commit <a href=\\\"/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0\\\">c2d72f5484</a> pushed by <a href=\\\"/user1\\\">user1</a>\",\"done\":false,\"jobs\":[{\"id\":396,\"name\":\"job_2\",\"status\":\"waiting\",\"canRerun\":false,\"duration\":\"_duration_\"}],\"commit\":{\"localeWorkflow\":\"Workflow\",\"localeAllRuns\":\"all runs\",\"shortSHA\":\"c2d72f5484\",\"link\":\"/user5/repo4/commit/c2d72f548424103f01ee1dc02889c1e2bff816b0\",\"pusher\":{\"displayName\":\"user1\",\"link\":\"/user1\"},\"branch\":{\"name\":\"test\",\"link\":\"/user5/repo4/src/branch/test\",\"isDeleted\":true}}},\"currentJob\":{\"title\":\"job_2\",\"details\":[\"Waiting for a runner with the following label: fedora\"],\"steps\":[],\"allAttempts\":null}},\"logs\":{\"stepsLog\":[]}}\n", actualClean)
|
||||
})
|
||||
htmlDoc.AssertAttrEqual(t, selector, "data-initial-artifacts-response", "{\"artifacts\":[]}\n")
|
||||
}
|
||||
|
|
|
|||
34
tests/integration/fixtures/TestActionRunsList/action_run.yml
Normal file
34
tests/integration/fixtures/TestActionRunsList/action_run.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
- id: 1000
|
||||
title: "A scheduled workflow"
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
workflow_id: "scheduled.yaml"
|
||||
index: 209
|
||||
trigger_user_id: -2
|
||||
ref: "refs/heads/main"
|
||||
commit_sha: "64357baca84bfff631e7dfae5a3433b26d005646"
|
||||
trigger_event: "schedule"
|
||||
is_fork_pull_request: false
|
||||
status: 6 # running
|
||||
started: 1683636528
|
||||
created: 1683636108
|
||||
updated: 1683636626
|
||||
need_approval: false
|
||||
approved_by: 0
|
||||
- id: 1001
|
||||
title: "Running workflow_dispatch"
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
workflow_id: "dispatch.yaml"
|
||||
index: 210
|
||||
trigger_user_id: 29
|
||||
ref: "refs/heads/main"
|
||||
commit_sha: "dc67f0a1a0dc2417cd0b1a9f0b95e2e5d91876e9"
|
||||
trigger_event: "workflow_dispatch"
|
||||
is_fork_pull_request: false
|
||||
status: 6 # running
|
||||
started: 1683636528
|
||||
created: 1683636108
|
||||
updated: 1683636626
|
||||
need_approval: false
|
||||
approved_by: 0
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
- id: 1000
|
||||
title: "A scheduled workflow"
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
workflow_id: "scheduled.yaml"
|
||||
index: 209
|
||||
trigger_user_id: -2
|
||||
ref: "refs/heads/master"
|
||||
commit_sha: "64357baca84bfff631e7dfae5a3433b26d005646"
|
||||
trigger_event: "schedule"
|
||||
is_fork_pull_request: false
|
||||
status: 5 # waiting
|
||||
started: 0
|
||||
created: 1683636108
|
||||
updated: 0
|
||||
need_approval: false
|
||||
approved_by: 0
|
||||
- id: 1001
|
||||
title: "A triggered run"
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
workflow_id: "dispatch.yaml"
|
||||
index: 210
|
||||
trigger_user_id: 29
|
||||
ref: "refs/heads/master"
|
||||
commit_sha: "f4100ac14112a3740490afb22b07b69b0b5d4e8b"
|
||||
trigger_event: "workflow_dispatch"
|
||||
is_fork_pull_request: false
|
||||
status: 5 # waiting
|
||||
started: 0
|
||||
created: 1683636108
|
||||
updated: 0
|
||||
need_approval: false
|
||||
approved_by: 0
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
- id: 2153
|
||||
run_id: 1000
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
commit_sha: 64357baca84bfff631e7dfae5a3433b26d005646
|
||||
is_fork_pull_request: false
|
||||
name: job_2
|
||||
attempt: 1
|
||||
runs_on: ["debian", "gpu"]
|
||||
job_id: job_2
|
||||
task_id: 8753
|
||||
status: 5 # StatusWaiting
|
||||
started: 0
|
||||
stopped: 0
|
||||
- id: 2154
|
||||
run_id: 1001
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
runs_on: ["windows"]
|
||||
commit_sha: f4100ac14112a3740490afb22b07b69b0b5d4e8b
|
||||
is_fork_pull_request: false
|
||||
name: mirror
|
||||
attempt: 1
|
||||
job_id: mirror
|
||||
task_id: 8754
|
||||
status: 5 # StatusWaiting
|
||||
started: 0
|
||||
stopped: 0
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
- id: 8753
|
||||
job_id: 2153
|
||||
attempt: 1
|
||||
runner_id: 0
|
||||
status: 1 # Waiting
|
||||
started: 0
|
||||
stopped: 0
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
commit_sha: 64357baca84bfff631e7dfae5a3433b26d005646
|
||||
is_fork_pull_request: false
|
||||
token_hash: 5fd2714302a06027c0184dbaa697dd1bea7ec80823b673aac8e378dbabdb3f4156bfad6995a8701ec18c187483db7253110e
|
||||
token_salt: ffffffffff
|
||||
token_last_eight: ffffffff
|
||||
- id: 8754
|
||||
job_id: 2154
|
||||
attempt: 1
|
||||
runner_id: 0
|
||||
status: 5 # Waiting
|
||||
started: 0
|
||||
stopped: 0
|
||||
repo_id: 4
|
||||
owner_id: 5
|
||||
commit_sha: f4100ac14112a3740490afb22b07b69b0b5d4e8b
|
||||
is_fork_pull_request: false
|
||||
token_hash: 9c104fe0db29aa6d737001707e1de2201fdfefb6d2316ec4fb38c44a1820a5948af2f9e1cb5e58ab95cc8fbe589fd4e82f95
|
||||
token_salt: ffffffffff
|
||||
token_last_eight: ffffffff
|
||||
Loading…
Add table
Add a link
Reference in a new issue