Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into option-for-apply-co…
Browse files Browse the repository at this point in the history
…nfig-pipeline

# Conflicts:
#	src/components/job-overview/index.tsx
#	src/store/radix-api.ts
  • Loading branch information
satr committed Nov 11, 2024
2 parents f2df530 + 5ae416a commit b2b4e27
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 34 deletions.
2 changes: 0 additions & 2 deletions docker-compose-host-macos.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
web:
image: node:20.9-alpine
Expand Down
2 changes: 0 additions & 2 deletions docker-compose-host.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
web:
image: node:20.9-alpine
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
web:
image: node:20.9-alpine
Expand Down
66 changes: 52 additions & 14 deletions src/components/create-job-form/pipeline-form-build-branches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function PipelineFormBuildBranches({
const [branch, setBranch] = useState('');
const [selectedBranch, setSelectedBranch] = useState('');
const [branchFullName, setBranchFullName] = useState('');
const [toEnvironment, setToEnvironment] = useState('');
const branches = useGetApplicationBranches(appName);

const handleOnTextChange = ({
Expand All @@ -54,7 +55,7 @@ export function PipelineFormBuildBranches({

const body = {
appName,
pipelineParametersBuild: { branch },
pipelineParametersBuild: { branch, toEnvironment },
};
let jobName = '';
if (pipelineName === 'build-deploy') {
Expand Down Expand Up @@ -102,22 +103,59 @@ export function PipelineFormBuildBranches({
))}
</NativeSelect>
{isAnyValidRegex(selectedBranch) && (
<fieldset>
<TextField
id="branch_full_name_field"
label="Branch full name"
helperText={`Pattern: ${selectedBranch}`}
name="branchFullName"
value={branchFullName}
onChange={handleOnTextChange}
/>
</fieldset>
<>
<Typography
group="input"
variant="text"
token={{ color: 'currentColor' }}
>
Git branch full name
</Typography>
<fieldset>
<TextField
id="branch_full_name_field"
helperText={`Pattern: ${selectedBranch}`}
name="branchFullName"
value={branchFullName}
onChange={handleOnTextChange}
/>
</fieldset>
</>
)}
{pipelineName === 'build-deploy' && (
{selectedBranch && branches[selectedBranch]?.length > 1 && (
<div className="grid grid--gap-small input">
<Typography
group="input"
variant="text"
token={{ color: 'currentColor' }}
>
Environment (optional)
</Typography>
<NativeSelect
id="ToEnvironmentSelect"
label=""
name="toEnvironment"
onChange={(e) => setToEnvironment(e.target.value)}
value={toEnvironment}
>
<option value="">
All environments build from the branch{' '}
{branch ?? selectedBranch}
</option>
{branches[selectedBranch]?.map((envName) => (
<option key={envName} value={envName}>
{envName}
</option>
))}
</NativeSelect>
</div>
)}
{pipelineName === 'build-deploy' && branches && selectedBranch && (
<TargetEnvs
branches={branches}
targetEnvs={
toEnvironment ? [toEnvironment] : branches[selectedBranch]
}
branch={branch}
selectedBranch={selectedBranch}
/>
)}
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/components/create-job-form/target-envs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { Typography } from '@equinor/eds-core-react';
import { Fragment } from 'react';

type Props = {
selectedBranch?: string;
branches: Record<string, Array<string>>;
targetEnvs: Array<string>;
branch?: string;
};
export function TargetEnvs({ selectedBranch, branches, branch }: Props) {
const targetEnvs = branches[selectedBranch] || [];
export function TargetEnvs({ targetEnvs, branch }: Props) {
const penultimateId = targetEnvs.length - 2;

return targetEnvs.length > 0 ? (
Expand Down
31 changes: 24 additions & 7 deletions src/components/job-overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,30 @@ export const JobOverview = ({ appName, jobName }: Props) => {
disabled={true}
/>
)}
{job.branch && (
<div>
<Typography>
Branch <strong>{job.branch}</strong>
</Typography>
</div>
)}
{job.deployedToEnvironment && (
<div>
<Typography>
Environment{' '}
<Typography
as={Link}
to={routeWithParams(routes.appEnvironment, {
appName,
envName: job.deployedToEnvironment,
})}
link
>
{job.deployedToEnvironment}
</Typography>
</Typography>
</div>
)}
<Typography>
Triggered by <strong>{job.triggeredBy || 'N/A'}</strong>
{job.commitID && (
Expand Down Expand Up @@ -338,13 +362,6 @@ export const JobOverview = ({ appName, jobName }: Props) => {
</Typography>
</Typography>
))}
{job.branch && (
<div>
<Typography>
Branch <strong>{job.branch}</strong>
</Typography>
</div>
)}
{job.components && (
<ComponentList
appName={appName}
Expand Down
2 changes: 1 addition & 1 deletion src/components/page-environment/environment-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const EnvironmentOverview: FunctionComponent<{
<Typography>
Environment <strong>{envName}</strong>
</Typography>
{environment.branchMapping ? (
{environment.branchMapping && environment.activeDeployment ? (
<Typography>
Built and deployed from{' '}
<Typography
Expand Down
10 changes: 8 additions & 2 deletions src/store/radix-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,8 @@ export type DeploymentSummary = {
activeFrom: string;
/** ActiveTo Timestamp when the deployment ends */
activeTo?: string;
/** Name of the branch used to build the deployment */
builtFromBranch?: string;
/** CommitID the commit ID of the branch to build */
commitID?: string;
/** Array of component summaries */
Expand Down Expand Up @@ -2844,7 +2846,7 @@ export type AlertingConfig = {
export type UpdateSlackConfigSecrets = {
/** WebhookURL the Slack webhook URL where alerts are sent
Secret key for webhook URL is updated if a non-nil value is present, and deleted if omitted or set to null
required: */
webhookUrl?: string | null;
};
Expand Down Expand Up @@ -3183,11 +3185,13 @@ export type Job = {
/** CommitID the commit ID of the branch to build */
commitID?: string;
/** Components (array of ComponentSummary) created by the job
Deprecated: Inspect each deployment to get list of components created by the job */
components?: ComponentSummary[];
/** Created timestamp */
created?: string;
/** DeployedToEnvironment the name of the environment that was deployed to */
deployedToEnvironment?: string;
/** DeployExternalDNS deploy external DNS */
deployExternalDNS?: boolean | null;
/** Array of deployments */
Expand Down Expand Up @@ -3430,6 +3434,8 @@ export type PipelineParametersBuild = {
overrideUseBuildCache?: boolean | null;
/** PushImage should image be pushed to container registry. Defaults pushing */
pushImage?: string;
/** Name of environment to build for */
toEnvironment?: string;
/** TriggeredBy of the job - if empty will use user token upn (user principle name) */
triggeredBy?: string;
};
Expand Down

0 comments on commit b2b4e27

Please sign in to comment.