Skip to content

Commit

Permalink
feat(release): add release command
Browse files Browse the repository at this point in the history
  • Loading branch information
josselinbuils authored and pfongkye committed Jun 27, 2024
1 parent 136e8d7 commit e55338f
Show file tree
Hide file tree
Showing 57 changed files with 3,440 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Here are the available commands:
| `/homer project add <project_name\|project_id>` | Add a Gitlab project to a channel. |
| `/homer project list` | List the Gitlab projects added to a channel. |
| `/homer project remove` | Remove a Gitlab project from a channel. |
| `/homer release` | Create a release for configured Gitlab project in a channel. |
| `/homer review <search>` | Share a merge request on a channel.<br />Searches in title and description by default.<br />Accepts merge request URLs and merge request IDs prefixed with "!". |
| `/homer review list` | List ongoing reviews shared in a channel. |

Expand Down
79 changes: 79 additions & 0 deletions __tests__/__fixtures__/deploymentFixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import type { GitlabDeployment } from '@/core/typings/GitlabDeployment';
import { pipelineFixture } from './pipelineFixture';
import { tagFixture } from './tagFixture';

export const deploymentFixture: GitlabDeployment = {
id: 42,
iid: 2,
ref: tagFixture.name,
sha: tagFixture.commit.id,
created_at: '2016-08-11T11:32:35.444Z',
updated_at: '2016-08-11T11:34:01.123Z',
status: 'success',
user: {
name: 'Administrator',
username: 'root',
id: 1,
state: 'active',
avatar_url:
'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
web_url: 'http://localhost:3000/root',
},
environment: {
id: 9,
name: 'production',
external_url: 'https://about.gitlab.com',
},
deployable: {
id: 664,
status: 'success',
stage: 'deploy',
name: 'deploy',
ref: 'main',
tag: false,
coverage: null,
created_at: '2016-08-11T11:32:24.456Z',
started_at: null,
finished_at: '2016-08-11T11:32:35.145Z',
project: {
ci_job_token_scope_enabled: false,
},
user: {
id: 1,
name: 'Administrator',
username: 'root',
state: 'active',
avatar_url:
'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
web_url: 'http://gitlab.dev/root',
created_at: '2015-12-21T13:14:24.077Z',
bio: null,
location: null,
skype: '',
linkedin: '',
twitter: '',
website_url: '',
organization: '',
},
commit: {
id: 'a91957a858320c0e17f3a0eca7cfacbff50ea29a',
short_id: 'a91957a8',
title: "Merge branch 'rename-readme' into 'main'\r",
author_name: 'Administrator',
author_email: '[email protected]',
created_at: '2016-08-11T13:28:26.000+02:00',
message:
"Merge branch 'rename-readme' into 'main'\r\n\r\nRename README\r\n\r\n\r\n\r\nSee merge request !2",
},
pipeline: {
...pipelineFixture,
created_at: '2016-08-11T07:43:52.143Z',
ref: tagFixture.name,
sha: tagFixture.commit.id,
status: 'success',
updated_at: '2016-08-11T07:43:52.143Z',
web_url: 'https://example.com/foo/bar/pipelines/61',
},
runner: null,
},
};
35 changes: 35 additions & 0 deletions __tests__/__fixtures__/dockerBuildJobFixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { GitlabJob } from '@/core/typings/GitlabJob';
import { pipelineFixture } from './pipelineFixture';
import { userDetailsFixture } from './userDetailsFixture';

export const dockerBuildJobFixture: GitlabJob = {
commit: {
author_email: '[email protected]',
author_name: 'Administrator',
created_at: '2015-12-24T16:51:14.000+01:00',
id: '0ff3ae198f8601a285adcf5c0fff204ee6fba5fd',
message: 'Test the CI integration.',
short_id: '0ff3ae19',
title: 'Test the CI integration.',
},
coverage: null,
allow_failure: false,
created_at: '2015-12-24T15:51:21.802Z',
started_at: '2015-12-24T17:54:27.722Z',
finished_at: '2015-12-24T17:54:27.895Z',
duration: 0.173,
queued_duration: 0.01,
artifacts: [],
artifacts_expire_at: '2016-01-23T17:54:27.895Z',
tag_list: ['docker runner', 'ubuntu18'],
id: 7,
name: 'build_image',
pipeline: pipelineFixture,
ref: 'main',
runner: null,
stage: 'test',
status: 'success',
tag: false,
web_url: 'https://example.com/foo/bar/-/jobs/7',
user: userDetailsFixture,
};
45 changes: 45 additions & 0 deletions __tests__/__fixtures__/hooks/deploymentHookFixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type { GitlabDeploymentHook } from '@/core/typings/GitlabDeploymentHook';
import { deploymentFixture } from '../deploymentFixture';
import { projectFixture } from '../projectFixture';

export const deploymentHookFixture: GitlabDeploymentHook = {
object_kind: 'deployment',
status: 'success',
status_changed_at: '2021-04-28 21:50:00 +0200',
deployment_id: deploymentFixture.id,
deployable_id: 796,
deployable_url:
'http://10.126.0.2:3000/root/diaspora-project-site/-/jobs/796',
environment: 'staging',
project: {
id: projectFixture.id,
name: 'diaspora-project-site',
description: '',
web_url: 'http://example.com/diaspora/diaspora-project-site',
avatar_url: null,
git_ssh_url: 'ssh://[email protected]:2222/root/diaspora-project-site.git',
git_http_url: 'http://example.com/diaspora/diaspora-project-site.git',
namespace: 'Administrator',
visibility_level: 0,
path_with_namespace: 'root/diaspora-project-site',
default_branch: 'master',
ci_config_path: '',
homepage: 'http://example.com/diaspora/diaspora-project-site',
url: 'ssh://[email protected]/diaspora/diaspora-project-site.git',
ssh_url: 'ssh://[email protected]/diaspora/diaspora-project-site.git',
http_url: 'http://example.com/diaspora/diaspora-project-site.git',
},
short_sha: '279484c0',
user: {
id: 1,
name: 'Administrator',
username: 'root',
avatar_url:
'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
email: '[email protected]',
},
user_url: 'http://10.126.0.2:3000/root',
commit_url:
'http://example.com/diaspora/diaspora-project-site/-/commit/279484c09fbe69ededfced8c1bb6e6d24616b468',
commit_title: 'Add new file',
};
39 changes: 39 additions & 0 deletions __tests__/__fixtures__/jobFixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type { GitlabJob } from '@/core/typings/GitlabJob';
import type { GitlabPipeline } from '@/core/typings/GitlabPipeline';
import { bridgeFixture } from './bridgeFixture';
import { userDetailsFixture } from './userDetailsFixture';

export const jobFixture: GitlabJob = {
commit: {
author_email: '[email protected]',
author_name: 'Administrator',
created_at: '2015-12-24T16:51:14.000+01:00',
id: '0ff3ae198f8601a285adcf5c0fff204ee6fba5fd',
message: 'Test the CI integration.',
short_id: '0ff3ae19',
title: 'Test the CI integration.',
},
coverage: null,
allow_failure: false,
created_at: '2015-12-24T15:51:21.802Z',
started_at: '2015-12-24T17:54:27.722Z',
finished_at: '2015-12-24T17:54:27.895Z',
duration: 0.173,
queued_duration: 0.01,
artifacts: [],
artifacts_expire_at: '2016-01-23T17:54:27.895Z',
tag_list: ['docker runner', 'ubuntu18'],
id: 7,
name: 'chat',
pipeline: {
...bridgeFixture.downstream_pipeline,
project_id: 12,
} as GitlabPipeline,
ref: 'main',
runner: null,
stage: 'test',
status: 'success',
tag: false,
web_url: 'https://example.com/foo/bar/-/jobs/7',
user: userDetailsFixture,
};
92 changes: 92 additions & 0 deletions __tests__/__fixtures__/releaseFixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { tagFixture } from './tagFixture';

export const releaseFixture = {
tag_name: tagFixture.name,
description: 'Super nice release',
name: 'New release',
description_html: '\u003cp dir="auto"\u003eSuper nice release\u003c/p\u003e',
created_at: '2019-01-03T02:22:45.118Z',
released_at: '2019-01-03T02:22:45.118Z',
author: {
id: 1,
name: 'Administrator',
username: 'root',
state: 'active',
avatar_url:
'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
web_url: 'https://gitlab.example.com/root',
},
commit: tagFixture.commit,
milestones: [
{
id: 51,
iid: 1,
project_id: 24,
title: 'v1.0-rc',
description: 'Voluptate fugiat possimus quis quod aliquam expedita.',
state: 'closed',
created_at: '2019-07-12T19:45:44.256Z',
updated_at: '2019-07-12T19:45:44.256Z',
due_date: '2019-08-16T11:00:00.256Z',
start_date: '2019-07-30T12:00:00.256Z',
web_url: 'https://gitlab.example.com/root/awesome-app/-/milestones/1',
issue_stats: {
total: 99,
closed: 76,
},
},
{
id: 52,
iid: 2,
project_id: 24,
title: 'v1.0',
description: 'Voluptate fugiat possimus quis quod aliquam expedita.',
state: 'closed',
created_at: '2019-07-16T14:00:12.256Z',
updated_at: '2019-07-16T14:00:12.256Z',
due_date: '2019-08-16T11:00:00.256Z',
start_date: '2019-07-30T12:00:00.256Z',
web_url: 'https://gitlab.example.com/root/awesome-app/-/milestones/2',
issue_stats: {
total: 24,
closed: 21,
},
},
],
commit_path:
'/root/awesome-app/commit/588440f66559714280628a4f9799f0c4eb880a4a',
tag_path: '/root/awesome-app/-/tags/v0.11.1',
evidence_sha: '760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d',
assets: {
count: 5,
sources: [
{
format: 'zip',
url: 'https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.zip',
},
{
format: 'tar.gz',
url: 'https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.tar.gz',
},
{
format: 'tar.bz2',
url: 'https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.tar.bz2',
},
{
format: 'tar',
url: 'https://gitlab.example.com/root/awesome-app/-/archive/v0.3/awesome-app-v0.3.tar',
},
],
links: [
{
id: 3,
name: 'hoge',
url: 'https://gitlab.example.com/root/awesome-app/-/tags/v0.11.1/binaries/linux-amd64',
external: true,
link_type: 'other',
},
],
evidence_file_path:
'https://gitlab.example.com/root/awesome-app/-/releases/v0.3/evidence.json',
},
};
Loading

0 comments on commit e55338f

Please sign in to comment.