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

Configure agent nodes based on jenkins instance type #513

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

Divyaasm
Copy link
Collaborator

@Divyaasm Divyaasm commented Dec 5, 2024

Description

Changes to include the agent nodes required for a jenkins instance type taking the values Bulid,Test,Release, benchmark, gradle.
This implentation brings up all agent nodes for type BTR, future enhancement will only bring up B/T/R related agent nodes only

Issues Resolved

#509

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

lib/ci-stack.ts Outdated
@@ -52,6 +52,8 @@ export interface CIStackProps extends StackProps {
readonly enableViews?: boolean;
/** Use Production Agents */
readonly useProdAgents?: boolean;
/** Specify jenkins instance type */
readonly jenkinsType?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: jenkinsDeploymentType?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or jenkinsInstanceType, Which name would you recommend?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm good with both.

Signed-off-by: Divya Madala <[email protected]>
Signed-off-by: Divya Madala <[email protected]>
Copy link
Collaborator

@rishabh6788 rishabh6788 left a comment

Choose a reason for hiding this comment

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

LGTM! @gaiksaya any other concerns?

lib/ci-stack.ts Outdated
@@ -28,6 +28,13 @@ import { JenkinsSecurityGroups } from './security/ci-security-groups';
import { JenkinsWAF } from './security/waf';
import { FineGrainedAccessSpecs } from './compute/auth-config';

enum DeploymentType {
BTR='BTR',
Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify for external community.

Suggested change
BTR='BTR',
BTR='BTR', // Build Test Release

lib/ci-stack.ts Outdated
@@ -53,6 +60,8 @@ export interface CIStackProps extends StackProps {
readonly enableViews?: boolean;
/** Use Production Agents */
readonly useProdAgents?: boolean;
/** Specify jenkins instance type */
readonly jenkinsInstanceType?: string;
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep it constant across the code. Either deploymentType or JenkinsInstanceType.
Also maybe the type should be string | DeploymentType

lib/ci-stack.ts Outdated
// eslint-disable-next-line no-console
console.warn('Please note that if you have decided to use the provided production jenkins agents then '
// eslint-disable-next-line no-console
console.warn('Please note that if you have decided to use the provided production jenkins agents then '
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the conditional useProdAgents required here?
The warning was only relevant if the ProdAgents parameter is enabled.

@@ -23,7 +23,7 @@ export interface AgentNodeProps {
amiId: string;
instanceType: string;
customDeviceMapping: string;
workerLabelString: string;
workerLabelString: string[];
Copy link
Member

Choose a reason for hiding this comment

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

How about make it [string, DeploymentType]. This way it will by default only accept the specified enum values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We already have a check for the enum values

else if (!Object.values(DeploymentType).includes(jenkinsInstanceType as DeploymentType)) {
throw new Error(Invalid jenkinsInstanceType value: ${jenkinsInstanceType});

and we have hardcoded the DeploymentType for each agent property anyway

workerLabelString: ['Jenkins-Agent-AL2023-X64-C54xlarge-Single-Host', 'BTR'],

Do we still require to change the type @gaiksaya?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed all other comments in the latest commit @gaiksaya

Copy link
Member

Choose a reason for hiding this comment

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

The condition will only be checked if the given value is undefined as per this code: https://github.com/opensearch-project/opensearch-ci/pull/513/files#diff-4b6fe4122d26e45b42b65d74533746571fed0807fe76bb2df2ea33b75227e004R130-R134
We want to check despite of that

Copy link
Member

Choose a reason for hiding this comment

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

Synced up offline. The if else block does the needful. We can iterate on this logic later.

Signed-off-by: Divya Madala <[email protected]>
@Divyaasm Divyaasm merged commit 64e1812 into opensearch-project:main Jan 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants