Rename to pipeline in DB and JSONs (#1296)

Closes #1282 

Follow-up to #1224, addresses #745

- changes JSON fields
- adds migration to rename columns
- fixes some comments
This commit is contained in:
qwerty287
2022-10-22 15:54:43 +02:00
committed by GitHub
parent 1114595078
commit f88c70b55e
24 changed files with 278 additions and 163 deletions

View File

@@ -1,4 +1,4 @@
import BuildStore from '~/store/pipelines';
import PipelineStore from '~/store/pipelines';
import RepoStore from '~/store/repos';
import { repoSlug } from '~/utils/helpers';
@@ -12,7 +12,7 @@ export default () => {
return;
}
const repoStore = RepoStore();
const buildStore = BuildStore();
const pipelineStore = PipelineStore();
initialized = true;
@@ -24,19 +24,19 @@ export default () => {
const { repo } = data;
repoStore.setRepo(repo);
// contains build update
// contains pipeline update
if (!data.pipeline) {
return;
}
const { pipeline } = data;
buildStore.setPipeline(repo.owner, repo.name, pipeline);
buildStore.setPipelineFeedItem({ ...pipeline, name: repo.name, owner: repo.owner, full_name: repoSlug(repo) });
pipelineStore.setPipeline(repo.owner, repo.name, pipeline);
pipelineStore.setPipelineFeedItem({ ...pipeline, name: repo.name, owner: repo.owner, full_name: repoSlug(repo) });
// contains proc update
if (!data.proc) {
return;
}
const { proc } = data;
buildStore.setProc(repo.owner, repo.name, pipeline.number, proc);
pipelineStore.setProc(repo.owner, repo.name, pipeline.number, proc);
});
};

View File

@@ -19,7 +19,7 @@ type RepoListOptions = {
flush?: boolean;
};
type BuildOptions = {
type PipelineOptions = {
branch: string;
variables: Record<string, string>;
};
@@ -58,7 +58,7 @@ export default class WoodpeckerClient extends ApiClient {
return this._post(`/api/repos/${owner}/${repo}/repair`);
}
createPipeline(owner: string, repo: string, options: BuildOptions): Promise<Pipeline> {
createPipeline(owner: string, repo: string, options: PipelineOptions): Promise<Pipeline> {
return this._post(`/api/repos/${owner}/${repo}/pipelines`, options) as Promise<Pipeline>;
}

View File

@@ -1,39 +1,39 @@
// A build for a repository.
// A pipeline for a repository.
export type Pipeline = {
id: number;
// The build number.
// This number is specified within the context of the repository the build belongs to and is unique within that.
// The pipeline number.
// This number is specified within the context of the repository the pipeline belongs to and is unique within that.
number: number;
parent: number;
event: 'push' | 'tag' | 'pull_request' | 'deployment' | 'cron' | 'manual';
// The current status of the build.
// The current status of the pipeline.
status: PipelineStatus;
error: string;
// When the build request was received.
// When the pipeline request was received.
created_at: number;
// When the build was updated last time in database.
// When the pipeline was updated last time in database.
updated_at: number;
// When the build was enqueued.
// When the pipeline was enqueued.
enqueued_at: number;
// When the build began execution.
// When the pipeline began execution.
started_at: number;
// When the build was finished.
// When the pipeline was finished.
finished_at: number;
// Where the deployment should go.
deploy_to: string;
// The commit for the build.
// The commit for the pipeline.
commit: string;
// The branch the commit was pushed to.
@@ -68,7 +68,7 @@ export type Pipeline = {
author_email: string;
// The link to view the repository.
// This link will point to the repository state associated with the build's commit.
// This link will point to the repository state associated with the pipeline's commit.
link_url: string;
signed: boolean;
@@ -79,8 +79,8 @@ export type Pipeline = {
reviewed_at: number;
// The jobs associated with this build.
// A build will have multiple jobs if a matrix build was used or if a rebuild was requested.
// The jobs associated with this pipeline.
// A pipeline will have multiple jobs if a matrix pipeline was used or if a rebuild was requested.
procs?: PipelineProc[];
changed_files?: string[];
@@ -100,7 +100,7 @@ export type PipelineStatus =
export type PipelineProc = {
id: number;
build_id: number;
pipeline_id: number;
pid: number;
ppid: number;
pgid: number;

View File

@@ -1,4 +1,4 @@
// A config for a build.
// A config for a pipeline.
export type PipelineConfig = {
hash: string;
name: string;

View File

@@ -35,16 +35,16 @@ export type Repo = {
// Whether the repository is publicly visible.
private: boolean;
// Whether the repository has trusted access for builds.
// Whether the repository has trusted access for pipelines.
// If the repository is trusted then the host network can be used and
// volumes can be created.
trusted: boolean;
// x-dart-type: Duration
// The amount of time in minutes before the build is killed.
// The amount of time in minutes before the pipeline is killed.
timeout: number;
// Whether pull requests should trigger a build.
// Whether pull requests should trigger a pipeline.
allow_pr: boolean;
config_file: string;