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

feat(self-hosted): convert experimental env vars to config options #29154

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

RahulGautamSingh
Copy link
Collaborator

@RahulGautamSingh RahulGautamSingh commented May 19, 2024

Changes

  • Converted the following experimental env vars to self-hosted config options
Env var Config option
RENOVATE_X_DELETE_CONFIG_FILE deleteConfigFile
RENOVATE_X_S3_ENDPOINT s3Endpoint
RENOVATE_X_S3_PATH_STYLE s3PathStyle

There are some boolean types here. They could not be converted to experimentalFlags because GlobalConfig hasn't been initialized yet, when they are used, hence converting them to self-hosted config options instead.

Context

Last of: #27879 (comment)

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository (locally)

@RahulGautamSingh RahulGautamSingh requested review from HonkingGoose, rarkins and viceice and removed request for HonkingGoose and rarkins May 19, 2024 10:40
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
docs/usage/self-hosted-configuration.md Outdated Show resolved Hide resolved
lib/config/options/index.ts Outdated Show resolved Hide resolved
lib/config/options/index.ts Outdated Show resolved Hide resolved
lib/config/options/index.ts Outdated Show resolved Hide resolved
lib/config/options/index.ts Outdated Show resolved Hide resolved
lib/config/options/index.ts Outdated Show resolved Hide resolved
lib/workers/global/config/parse/file.ts Outdated Show resolved Hide resolved
@RahulGautamSingh
Copy link
Collaborator Author

Verified each migration locally, by either logging the values of each option at runtime or confirming that they are working as expected
check 1: default values passed to functions ☑️
check 2: custom values (from cli, env, file), overwrites default values ☑️
check 3: old env vars parsed and then overwrite the default values ☑️

lib/config/options/index.ts Outdated Show resolved Hide resolved
Comment on lines +1161 to +1168
## s3PathStyle

If set, Renovate will enable `forcePathStyle` when creating the AWS S3 client instance.

> Whether to force path-style URLs for S3 objects (e.g., `https://s3.amazonaws.com//` instead of `https://.s3.amazonaws.com/`)

Source: [AWS S3 documentation - Interface BucketEndpointInputConfig](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/bucketendpointinputconfig.html)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Gabriel-Ladzaretti why is this necessary? Isn't it the same administrator who's configuring the S3?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is mainly used for s3 compatible solutions that dont support or are not configured to use virtual-hosted–style requests. It essentially alters the way the aws client constructs and resolves urls.
path-style-access
e.g, https://s3.amazonaws.com/mybucket/myfile
vs
virtual-hosted-style-access
e,g, https://mybucket.s3.amazonaws.com/myfile

i dont think there is another way to support these s3 instances.

Copy link
Member

Choose a reason for hiding this comment

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

I use it for my Minio instance

Comment on lines +1161 to +1168
## s3PathStyle

If set, Renovate will enable `forcePathStyle` when creating the AWS S3 client instance.

> Whether to force path-style URLs for S3 objects (e.g., `https://s3.amazonaws.com//` instead of `https://.s3.amazonaws.com/`)

Source: [AWS S3 documentation - Interface BucketEndpointInputConfig](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/bucketendpointinputconfig.html)

Copy link
Member

Choose a reason for hiding this comment

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

I use it for my Minio instance

@@ -89,7 +89,7 @@ export async function exportStats(config: RenovateConfig): Promise<void> {
ContentType: 'application/json',
};

const client = getS3Client();
const client = getS3Client(config.s3Endpoint, config.s3PathStyle);
Copy link
Member

Choose a reason for hiding this comment

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

Is this required because we didn't initialized the global config at that time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, we do not have global config class initialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants