Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for apply config pipeline #1124

Merged
merged 7 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/components/create-job-form/pipeline-form-apply-config.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Button, CircularProgress, Typography } from '@equinor/eds-core-react';
import type { FormEvent } from 'react';

import {
Button,
Checkbox,
CircularProgress,
List,
Typography,
} from '@equinor/eds-core-react';
import { type FormEvent, useState } from 'react';
import { useTriggerPipelineApplyConfigMutation } from '../../store/radix-api';
import { getFetchErrorMessage } from '../../store/utils';
import { Alert } from '../alert';
Expand All @@ -13,13 +18,16 @@ export function PipelineFormApplyConfig({
onSuccess,
}: FormProp) {
const [trigger, state] = useTriggerPipelineApplyConfigMutation();
const [deployExternalDNS, setDeployExternalDNS] = useState(false);
const handleSubmit = handlePromiseWithToast(
async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();

const response = await trigger({
appName,
pipelineParametersApplyConfig: {},
pipelineParametersApplyConfig: {
deployExternalDNS: deployExternalDNS,
},
}).unwrap();
onSuccess(response.name);
}
Expand All @@ -39,6 +47,20 @@ export function PipelineFormApplyConfig({
>
Apply Radix config
</Typography>
<List className="grid grid--gap-x-small">
<List.Item>
Apply changes in DNS alias, build secrets, environments (create
new or soft-delete existing)
</List.Item>
<List.Item>
<Checkbox
label="Deploy External DNS-es"
name="deployExternalDNS"
checked={deployExternalDNS}
onChange={() => setDeployExternalDNS(!deployExternalDNS)}
/>
</List.Item>
</List>
</div>
<div className="o-action-bar">
{state.isLoading && (
Expand Down
25 changes: 24 additions & 1 deletion src/components/job-overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Button, CircularProgress, Typography } from '@equinor/eds-core-react';
import {
Button,
Checkbox,
CircularProgress,
Typography,
} from '@equinor/eds-core-react';
import * as PropTypes from 'prop-types';
import { useState } from 'react';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -240,6 +245,24 @@ export const JobOverview = ({ appName, jobName }: Props) => {
</Typography>
</Typography>
)}
{(job.pipeline === 'build-deploy' ||
job.pipeline === 'build') &&
job.overrideUseBuildCache !== undefined && (
<Checkbox
label="Override use build cache"
name="overrideUseBuildCache"
checked={job.overrideUseBuildCache}
disabled={true}
/>
)}
{job.pipeline === 'apply-config' && (
<Checkbox
label="Deploy external DNS-es"
name="deployExternalDNS"
checked={job.deployExternalDNS === true}
disabled={true}
/>
)}
<Typography>
Triggered by <strong>{job.triggeredBy || 'N/A'}</strong>
{job.commitID && (
Expand Down
21 changes: 18 additions & 3 deletions src/store/radix-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,8 @@ export type JobSummary = {
commitID?: string;
/** Created timestamp */
created?: string;
/** DeployExternalDNS deploy external DNS */
deployExternalDNS?: boolean | null;
/** Ended timestamp */
ended?: string;
/** Environments the job deployed to */
Expand All @@ -2586,7 +2588,7 @@ export type JobSummary = {
/** OverrideUseBuildCache override default or configured build cache option */
overrideUseBuildCache?: boolean | null;
/** Name of the pipeline */
pipeline?: 'build' | 'build-deploy' | 'promote' | 'deploy';
pipeline?: 'build' | 'build-deploy' | 'promote' | 'deploy' | 'apply-config';
/** RadixDeployment name, which is promoted */
promotedFromDeployment?: string;
/** Environment name, from which the Radix deployment is promoted */
Expand Down Expand Up @@ -2732,7 +2734,12 @@ export type DeploymentSummary = {
/** Name the unique name of the Radix application deployment */
name: string;
/** Type of pipeline job */
pipelineJobType?: 'build' | 'build-deploy' | 'promote' | 'deploy';
pipelineJobType?:
| 'build'
| 'build-deploy'
| 'promote'
| 'deploy'
| 'apply-config';
/** Name of the environment the deployment was promoted from
Applies only for pipeline jobs of type 'promote' */
promotedFromEnvironment?: string;
Expand Down Expand Up @@ -3181,6 +3188,8 @@ export type Job = {
components?: ComponentSummary[];
/** Created timestamp */
created?: string;
/** DeployExternalDNS deploy external DNS */
deployExternalDNS?: boolean | null;
/** Array of deployments */
deployments?: DeploymentSummary[];
/** Ended timestamp */
Expand All @@ -3191,8 +3200,10 @@ export type Job = {
};
/** Name of the job */
name?: string;
/** OverrideUseBuildCache override default or configured build cache option */
overrideUseBuildCache?: boolean | null;
/** Name of the pipeline */
pipeline?: 'build' | 'build-deploy' | 'promote' | 'deploy';
pipeline?: 'build' | 'build-deploy' | 'promote' | 'deploy' | 'apply-config';
/** RadixDeployment name, which is promoted */
promotedFromDeployment?: string;
/** PromotedFromEnvironment the name of the environment that was promoted from */
Expand Down Expand Up @@ -3395,6 +3406,8 @@ export type PipelineRunTaskStep = {
statusMessage?: string;
};
export type PipelineParametersApplyConfig = {
/** DeployExternalDNS deploy external DNS */
deployExternalDNS?: boolean | null;
/** TriggeredBy of the job - if empty will use user token upn (user principle name) */
triggeredBy?: string;
};
Expand All @@ -3405,6 +3418,8 @@ export type PipelineParametersBuild = {
/** CommitID the commit ID of the branch to build
REQUIRED for "build" and "build-deploy" pipelines */
commitID?: string;
/** DeployExternalDNS deploy external DNS */
deployExternalDNS?: boolean | null;
/** ImageName of the component, without repository name and image-tag */
imageName?: string;
/** ImageRepository of the component, without image name and image-tag */
Expand Down