mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-13 06:20:24 +00:00
fix: display action run attempt status instead of job status (#10321)
On the page displaying the logs of an action run attempt, the header directly above the logs always showed the status of the job. That resulted in the wrong status being displayed for previous run attempts. Fixes https://codeberg.org/forgejo/forgejo/issues/10236.  ## 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 - 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 added test coverage for JavaScript changes... - [x] in `web_src/js/*.test.js` if it can be unit tested. - [x] 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. - [ ] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [ ] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/10321): <!--number 10321 --><!--line 0 --><!--description ZGlzcGxheSBhY3Rpb24gcnVuIGF0dGVtcHQgc3RhdHVzIGluc3RlYWQgb2Ygam9iIHN0YXR1cw==-->display action run attempt status instead of job status<!--description--> <!--end release-notes-assistant--> Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10321 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
9dec4c2888
commit
ff4038970d
7 changed files with 186 additions and 133 deletions
|
|
@ -94,6 +94,7 @@ test('processes ##[group] and ##[endgroup]', async () => {
|
|||
},
|
||||
},
|
||||
currentJob: {
|
||||
title: 'Test',
|
||||
steps: [
|
||||
{
|
||||
summary: 'Test Job',
|
||||
|
|
@ -101,7 +102,7 @@ test('processes ##[group] and ##[endgroup]', async () => {
|
|||
status: 'success',
|
||||
},
|
||||
],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success'}],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success', status_diagnostics: ['Success']}],
|
||||
},
|
||||
},
|
||||
logs: {
|
||||
|
|
@ -186,6 +187,7 @@ test('load multiple steps on a finished action', async () => {
|
|||
},
|
||||
},
|
||||
currentJob: {
|
||||
title: 'test',
|
||||
steps: [
|
||||
{
|
||||
summary: 'Test Step #1',
|
||||
|
|
@ -198,7 +200,7 @@ test('load multiple steps on a finished action', async () => {
|
|||
status: 'success',
|
||||
},
|
||||
],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success'}],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success', status_diagnostics: ['Success']}],
|
||||
},
|
||||
},
|
||||
logs: {
|
||||
|
|
@ -231,6 +233,11 @@ test('load multiple steps on a finished action', async () => {
|
|||
expect(wrapper.get('.job-step-section:nth-of-type(2) .job-log-line:nth-of-type(1) .log-msg').text()).toEqual('Step #2 Log #1');
|
||||
expect(wrapper.get('.job-step-section:nth-of-type(2) .job-log-line:nth-of-type(2) .log-msg').text()).toEqual('Step #2 Log #2');
|
||||
expect(wrapper.get('.job-step-section:nth-of-type(2) .job-log-line:nth-of-type(3) .log-msg').text()).toEqual('Step #2 Log #3');
|
||||
|
||||
// Attempt status
|
||||
expect(wrapper.get('.job-info-header h3').text()).toEqual('test');
|
||||
expect(wrapper.findAll('ul.job-info-header-detail li').length).toEqual(1);
|
||||
expect(wrapper.get('ul.job-info-header-detail li:nth-child(1)').text()).toEqual('Success');
|
||||
});
|
||||
|
||||
function configureForMultipleAttemptTests({viewHistorical}) {
|
||||
|
|
@ -246,6 +253,7 @@ function configureForMultipleAttemptTests({viewHistorical}) {
|
|||
},
|
||||
},
|
||||
currentJob: {
|
||||
title: 'test',
|
||||
steps: [
|
||||
{
|
||||
summary: 'Test Job',
|
||||
|
|
@ -254,8 +262,8 @@ function configureForMultipleAttemptTests({viewHistorical}) {
|
|||
},
|
||||
],
|
||||
allAttempts: [
|
||||
{number: 2, time_since_started_html: 'yesterday', status: 'success'},
|
||||
{number: 1, time_since_started_html: 'two days ago', status: 'failure'},
|
||||
{number: 2, time_since_started_html: 'yesterday', status: 'success', status_diagnostics: ['Success']},
|
||||
{number: 1, time_since_started_html: 'two days ago', status: 'failure', status_diagnostics: ['Failure']},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -315,6 +323,11 @@ test('display baseline with most-recent attempt', async () => {
|
|||
expect(wrapper.findAll('.job-attempt-dropdown').length).toEqual(1);
|
||||
expect(wrapper.findAll('.job-attempt-dropdown .svg.octicon-check-circle-fill.text.green').length).toEqual(1);
|
||||
expect(wrapper.get('.job-attempt-dropdown .ui.dropdown').text()).toEqual('Run attempt 2 yesterday');
|
||||
|
||||
// Attempt status
|
||||
expect(wrapper.get('.job-info-header h3').text()).toEqual('test');
|
||||
expect(wrapper.findAll('ul.job-info-header-detail li').length).toEqual(1);
|
||||
expect(wrapper.get('ul.job-info-header-detail li:nth-child(1)').text()).toEqual('Success');
|
||||
});
|
||||
|
||||
test('display reconfigured for historical attempt', async () => {
|
||||
|
|
@ -342,6 +355,11 @@ test('display reconfigured for historical attempt', async () => {
|
|||
expect(wrapper.findAll('.job-attempt-dropdown').length).toEqual(1);
|
||||
expect(wrapper.findAll('.job-attempt-dropdown .svg.octicon-x-circle-fill.text.red').length).toEqual(1);
|
||||
expect(wrapper.get('.job-attempt-dropdown .ui.dropdown').text()).toEqual('Run attempt 1 two days ago');
|
||||
|
||||
// Attempt status
|
||||
expect(wrapper.get('.job-info-header h3').text()).toEqual('test');
|
||||
expect(wrapper.findAll('ul.job-info-header-detail li').length).toEqual(1);
|
||||
expect(wrapper.get('ul.job-info-header-detail li:nth-child(1)').text()).toEqual('Failure');
|
||||
});
|
||||
|
||||
test('historical attempt dropdown interactions', async () => {
|
||||
|
|
@ -476,6 +494,7 @@ test('artifacts download links', async () => {
|
|||
},
|
||||
},
|
||||
currentJob: {
|
||||
title: 'test',
|
||||
steps: [
|
||||
{
|
||||
summary: 'Test Step #1',
|
||||
|
|
@ -483,7 +502,7 @@ test('artifacts download links', async () => {
|
|||
status: 'success',
|
||||
},
|
||||
],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success'}],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success', status_diagnostics: ['Success']}],
|
||||
},
|
||||
},
|
||||
logs: {
|
||||
|
|
@ -628,6 +647,11 @@ test('view non-picked action run job', async () => {
|
|||
expect(wrapper.get('.job-brief-list .job-brief-item:nth-of-type(1) .job-brief-name').text()).toEqual('check-1');
|
||||
expect(wrapper.get('.job-brief-list .job-brief-item:nth-of-type(2) .job-brief-name').text()).toEqual('check-2');
|
||||
expect(wrapper.get('.job-brief-list .job-brief-item:nth-of-type(3) .job-brief-name').text()).toEqual('check-3');
|
||||
|
||||
// Attempt status
|
||||
expect(wrapper.get('.job-info-header h3').text()).toEqual('check-1');
|
||||
expect(wrapper.findAll('ul.job-info-header-detail li').length).toEqual(1);
|
||||
expect(wrapper.get('ul.job-info-header-detail li:nth-child(1)').text()).toEqual('waiting (locale)');
|
||||
});
|
||||
|
||||
test('view without pre-execution error', async () => {
|
||||
|
|
@ -686,6 +710,7 @@ test('Offset index', async () => {
|
|||
},
|
||||
},
|
||||
currentJob: {
|
||||
title: 'test',
|
||||
steps: [
|
||||
{
|
||||
summary: 'Test Job',
|
||||
|
|
@ -693,7 +718,7 @@ test('Offset index', async () => {
|
|||
status: 'success',
|
||||
},
|
||||
],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success'}],
|
||||
allAttempts: [{number: 1, time_since_started_html: '', status: 'success', status_diagnostics: ['Success']}],
|
||||
},
|
||||
},
|
||||
logs: {
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ export default {
|
|||
// initial value here is configured so that currentingViewingMostRecentAttempt() -> true on the default `data()`, so that the
|
||||
// initial render (before `loadJob`'s first execution is complete) doesn't display "You are viewing an
|
||||
// out-of-date run..."
|
||||
allAttempts: new Array(parseInt(this.attemptNumber)).fill({index: 0, time_since_started_html: '', status: 'success'}),
|
||||
allAttempts: new Array(parseInt(this.attemptNumber)).fill({index: 0, time_since_started_html: '', status: 'success', status_diagnostics: []}),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -158,6 +158,7 @@ export default {
|
|||
if (!this.currentJob.allAttempts) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
const attempt = this.currentJob.allAttempts.find((attempt) => attempt.number === this.viewingAttemptNumber);
|
||||
return attempt || fallback;
|
||||
},
|
||||
|
|
@ -181,6 +182,18 @@ export default {
|
|||
return this.locale.viewingOutOfDateRun
|
||||
.replace('%[1]s', this.viewingAttempt.time_since_started_html);
|
||||
},
|
||||
|
||||
statusDiagnostics() {
|
||||
if (!this.currentJob.allAttempts) {
|
||||
return this.currentJob.details;
|
||||
}
|
||||
|
||||
const useAttempt = this.currentJob.allAttempts.some((attempt) => attempt.number === this.viewingAttemptNumber);
|
||||
if (useAttempt) {
|
||||
return this.viewingAttempt.status_diagnostics;
|
||||
}
|
||||
return this.currentJob.details;
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
|
|
@ -616,7 +629,7 @@ export default {
|
|||
{{ currentJob.title }}
|
||||
</h3>
|
||||
<ul class="job-info-header-detail">
|
||||
<li v-for="detail in currentJob.details" :key="detail">
|
||||
<li v-for="detail in statusDiagnostics" :key="detail">
|
||||
{{ detail }}
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue