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

Added new output parameters and updated jenkins image tag #128

Merged
merged 1 commit into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Push new jenkins docker image

on:
push:
paths:
paths:
- docker/**
workflow_dispatch:

Expand All @@ -26,4 +26,4 @@ jobs:
platforms: linux/amd64,linux/arm64
context: "{{defaultContext}}:docker"
push: true
tags: opensearchstaging/jenkins:2.332.2-lts,opensearchstaging/jenkins:latest
tags: opensearchstaging/jenkins:2.332.3-lts,opensearchstaging/jenkins:latest
7 changes: 6 additions & 1 deletion lib/compute/agent-node-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Role, ManagedPolicy, PolicyStatement, Effect, CfnInstanceProfile, ServicePrincipal,
} from '@aws-cdk/aws-iam';
import {
Fn, Stack, Tags, CfnParameter,
Fn, Stack, Tags, CfnOutput,
} from '@aws-cdk/core';
import { KeyPair } from 'cdk-ec2-key-pair';
import { readFileSync } from 'fs';
Expand Down Expand Up @@ -116,6 +116,11 @@ export class AgentNodeConfig {
const AgentNodeInstanceProfile = new CfnInstanceProfile(stack, 'JenkinsAgentNodeInstanceProfile', { roles: [AgentNodeRole.roleName] });
this.AgentNodeInstanceProfileArn = AgentNodeInstanceProfile.attrArn.toString();
this.SSHEC2KeySecretId = Fn.join('/', ['ec2-ssh-key', key.keyPairName.toString(), 'private']);

new CfnOutput(stack, 'Jenkins Agent Node Role Arn', {
value: `${AgentNodeRole.roleArn}`,
exportName: 'agentNodeRoleArn',
});
}

public addAgentConfigToJenkinsYaml(templates: AgentNodeProps[], props: AgentNodeNetworkProps): any {
Expand Down
7 changes: 6 additions & 1 deletion lib/compute/jenkins-main-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

import { Duration, Stack } from '@aws-cdk/core';
import { CfnOutput, Duration, Stack } from '@aws-cdk/core';
import {
AmazonLinuxGeneration,
BlockDeviceVolume,
Expand Down Expand Up @@ -153,6 +153,11 @@ export class JenkinsMainNode {
JenkinsMainNode.createPoliciesForMainNode(stack).map(
(policy) => this.ec2Instance.role.addManagedPolicy(policy),
);

new CfnOutput(stack, 'Jenkins Main Node Role Arn', {
value: this.ec2Instance.role.roleArn,
exportName: 'mainNodeRoleArn',
});
}

public static createPoliciesForMainNode(stack: Stack): (IManagedPolicy | ManagedPolicy)[] {
Expand Down