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

Restore previous secrets and update cfn parameter #512

Merged
merged 1 commit into from
Nov 27, 2024
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
11 changes: 10 additions & 1 deletion lib/ci-config-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export class CIConfigStack extends Stack {

static readonly REDIRECT_URL_SECRET_EXPORT_VALUE: string = 'redirectUrlSecret';

static readonly OIDC_CONFIGURATION_VALUE_SECRET_EXPORT_VALUE: string = 'OIDCConfigValueSecret';

static readonly AUTH_CONFIGURATION_VALUE_SECRET_EXPORT_VALUE: string = 'authConfigValueSecret';

static readonly CASC_RELOAD_TOKEN_SECRET_EXPORT_VALUE: string = 'casc';
Expand All @@ -43,10 +45,12 @@ export class CIConfigStack extends Stack {
const redirectUrlSecret = new Secret(this, 'redirectUrl', {
description: 'Redirect url for Jenkins',
});
const OIDCConfigValuesSecret = new Secret(this, 'OIDCConfigValues', {
description: 'OIDC params in JSON format',
});
const authConfigValuesSecret = new Secret(this, 'authConfigValues', {
description: 'Auth credentials in JSON format',
});

const CascReloadTokenValuesSecret = new Secret(this, 'CascReloadTokenValue', {
description: 'Reload token (password) required for configuration as code plugin',
});
Expand Down Expand Up @@ -76,6 +80,11 @@ export class CIConfigStack extends Stack {
exportName: CIConfigStack.REDIRECT_URL_SECRET_EXPORT_VALUE,
});

new CfnOutput(this, 'OIDCConfigValuesSecret', {
value: OIDCConfigValuesSecret.secretArn,
exportName: CIConfigStack.OIDC_CONFIGURATION_VALUE_SECRET_EXPORT_VALUE,
});

new CfnOutput(this, 'authConfigValuesSecret', {
value: authConfigValuesSecret.secretArn,
exportName: CIConfigStack.AUTH_CONFIGURATION_VALUE_SECRET_EXPORT_VALUE,
Expand Down
6 changes: 3 additions & 3 deletions lib/ci-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface CIStackProps extends StackProps {
/** Should the Jenkins use https */
readonly useSsl?: boolean;
/** Type of login mechanism to adopt */
readonly authType?:string;
readonly authType?: string;
/** Restrict jenkins access to */
readonly restrictServerAccessTo?: IPeer;
/** Additional verification during deployment and resource startup. */
Expand Down Expand Up @@ -123,8 +123,8 @@ export class CIStack extends Stack {
const additionalCommandsContext = `${props?.additionalCommands ?? this.node.tryGetContext('additionalCommands')}`;

// Setting CfnParameters to record the value in cloudFormation
new CfnParameter(this, 'runWithOidc', {
description: 'If the jenkins instance should use OIDC + federate',
new CfnParameter(this, 'authType', {
description: 'Auth type for jenkins login',
default: authType,
});

Expand Down