Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Stepanov <astepano@redhat.com>
  • Loading branch information
Andrei-Stepanov committed Mar 12, 2024
1 parent 4ab339e commit 62ad11c
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/fedoraci/ciboard-server:f213021
FROM quay.io/fedoraci/ciboard-server:aab4ae6

# npm mirror to use to install dependencies.
ARG NPMLOCATION=open
Expand Down
43 changes: 41 additions & 2 deletions src/components/PageDetails/BuildInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This file is part of ciboard
*
* Copyright (c) 2023 Matěj Grabovský <mgrabovs@redhat.com>
* Copyright (c) 2023 Andrei Stepanov <astepano@redhat.com>
* Copyright (c) 2023, 2024 Andrei Stepanov <astepano@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -40,10 +40,11 @@ import {
EmptyStateBody,
EmptyStateIcon,
DescriptionList,
EmptyStateHeader,
DescriptionListTerm,
DescriptionListGroup,
DescriptionListDescription,
EmptyStateHeader,
Truncate,
} from '@patternfly/react-core';
import { ExclamationCircleIcon } from '@patternfly/react-icons';

Expand Down Expand Up @@ -293,6 +294,44 @@ function BuildMetadataRpm(props: BuildMetadataRpmProps) {
},
];

if (_.isArray(build.gitlabCommitMr) && _.size(build.gitlabCommitMr)) {
const csItems = [
{
label: 'GitLab MR Author',
value: (
<ExternalLink href={build.gitlabCommitMr[0].author.web_url}>
{build.gitlabCommitMr[0].author.name}
</ExternalLink>
),
},
{
label: 'GitLab MR title',
value: (
<Truncate
content={build.gitlabCommitMr[0].title}
tooltipPosition={'bottom'}
/>
),
},
{
label: 'GitLab MR link',
value: (
<ExternalLink href={build.gitlabCommitMr[0].web_url}>
<Truncate
style={{ maxWidth: '300px' }}
content={build.gitlabCommitMr[0].web_url}
/>
</ExternalLink>
),
},
{
label: 'GitLab MR target branch',
value: <>{build.gitlabCommitMr[0].target_branch}</>,
},
];
items.push(...csItems);
}

const descListClassName = classNames(
'pf-v5-u-px-lg',
'pf-v5-u-py-md',
Expand Down
1 change: 1 addition & 0 deletions src/queries/Artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const ArtifactsDetailedInfoKojiTask = gql`
commit_obj(instance: $distgit_instance) {
...CommitInfoFragment
}
gitlabCommitMr
}
}
}
Expand Down
49 changes: 49 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,54 @@ export interface CommitObject {
committer_name: string;
}

// https://docs.gitlab.com/ee/api/commits.html#list-merge-requests-associated-with-a-commit

export interface GitlabCommitMr {
id: number;
iid: number;
project_id: number;
title: string;
description: string;
state: string;
created_at: string;
updated_at: string;
target_branch: string;
source_branch: string;
upvotes: number;
downvotes: number;
author: {
web_url: string;
name: string;
avatar_url: string;
username: string;
state: string;
id: number;
};
assignee: null | string;
source_project_id: number;
target_project_id: number;
labels: string[];
draft: boolean;
work_in_progress: boolean;
milestone: null | string;
merge_when_pipeline_succeeds: boolean;
merge_status: boolean;
sha: string;
merge_commit_sha: string | null;
squash_commit_sha: string | null;
user_notes_count: number;
discussion_locked: null | boolean;
should_remove_source_branch: null | boolean;
force_remove_source_branch: boolean;
web_url: string;
time_stats: {
time_estimate: number;
total_time_spent: number;
human_time_estimate: null | string;
human_total_time_spent: null | string;
};
}

export interface KojiBuildTag {
id: number;
name: string;
Expand All @@ -1029,6 +1077,7 @@ export interface KojiHistory {
export interface KojiBuildInfo {
build_id: number;
commit_obj?: CommitObject;
gitlabCommitMr?: GitlabCommitMr[];
completion_time: string;
completion_ts: number;
history?: KojiHistory;
Expand Down

0 comments on commit 62ad11c

Please sign in to comment.