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

fix: #8947 yarn 3 workspaces #8961

Merged
merged 7 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { AbstractWorkflow, PusherProvider, SqsProvider, Workflow } from '../even
import { SoruceProvider } from './source-provider'
import { CodeBuild } from 'aws-sdk'
import yaml from 'yaml'
import { PackageManagerEnum } from '../pipeline/pipeline-dto'
import { S3Provider } from '../s3'
import { TaskEntity } from '../entities/task.entity'
import { PipelineRunnerProvider } from '../pipeline-runner'
import { plainToClass } from 'class-transformer'
import { BitbucketClientData } from '../entities/bitbucket-client.entity'
import { BitBucketEvent } from '../bitbucket'
import { ParameterProvider } from '../pipeline'
import { PackageManagerEnum } from '@reapit/foundations-ts-definitions/deployment-schema'

@Workflow(QueueNamesEnum.CODEBUILD_EXECUTOR)
export class CodebuildExecutorWorkflow extends AbstractWorkflow<{
Expand Down Expand Up @@ -125,6 +125,19 @@ export class CodebuildExecutorWorkflow extends AbstractWorkflow<{
}) {
const params = await this.parameterProvider.obtainParameters(pipeline.id as string)

const setupCommands = [
'n install 14',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Node 18 please? See my prev on tech debt and Node EOL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

'n use 14',
'CACHE_FOLDER=$(find . -maxdepth 1 -mindepth 1 -type d)',
'echo $CACHE_FOLDER',
'mv $CACHE_FOLDER/* ./',
'rm -rf $CACHE_FOLDER',
]

if (pipeline.packageManager && pipeline.packageManager === PackageManagerEnum.YARN_BERRY) {
setupCommands.push('yarn set version berry')
}

const start = this.codeBuild.startBuild({
projectName: process.env.CODE_BUILD_PROJECT_NAME as string,
buildspecOverride: yaml.stringify({
Expand All @@ -138,12 +151,7 @@ export class CodebuildExecutorWorkflow extends AbstractWorkflow<{
nodejs: 12,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also Node 12 here!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

},
commands: [
'n install 14',
'n use 14',
'CACHE_FOLDER=$(find . -maxdepth 1 -mindepth 1 -type d)',
'echo $CACHE_FOLDER',
'mv $CACHE_FOLDER/* ./',
'rm -rf $CACHE_FOLDER',
...setupCommands,
pipeline.packageManager === PackageManagerEnum.YARN
? pipeline.packageManager
: `${pipeline.packageManager} install`,
Expand Down
6 changes: 1 addition & 5 deletions packages/deployment-service/src/pipeline/pipeline-dto.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { PackageManagerEnum } from '@reapit/foundations-ts-definitions/deployment-schema'
import { IsString, IsNotEmpty, IsOptional, IsEnum, MaxLength, IsUUID, Matches, IsUrl } from 'class-validator'

export enum AppTypeEnum {
REACT = 'react',
NODE = 'node',
}

export enum PackageManagerEnum {
YARN = 'yarn',
NPM = 'npm',
}

export class PipelineDto {
@IsString()
@IsNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
InputGroup,
InputWrap,
Label,
Select,
Toggle,
} from '@reapit/elements'
import { boolean, object, SchemaOf, string } from 'yup'
Expand Down Expand Up @@ -206,11 +207,12 @@ export const PipelineConfigure: FC = () => {
</InputWrap>
<InputWrap>
<InputGroup>
<Toggle id="package-manager-toggle" hasGreyBg {...register('packageManager')}>
<ElToggleItem>Yarn</ElToggleItem>
<ElToggleItem>NPM</ElToggleItem>
</Toggle>
<Label>Package Manager</Label>
<Select id="package-manager-select" {...register('packageManager')}>
<option value={PackageManagerEnum.NPM}>NPM</option>
<option value={PackageManagerEnum.YARN}>YARN</option>
<option value={PackageManagerEnum.YARN_BERRY}>YARN BERRY</option>
</Select>
{errors.packageManager?.message && <InputError message={errors.packageManager.message} />}
</InputGroup>
</InputWrap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export interface TaskModelInterface {
export enum PackageManagerEnum {
NPM = 'npm',
YARN = 'yarn',
YARN_BERRY = 'yarn-berry',
}

export enum AppTypeEnum {
Expand Down