Skip to content

Conversation

@Torch3333
Copy link
Contributor

@Torch3333 Torch3333 commented Jun 18, 2024

Description

The CosmosDB CI fails when using JDK11+ as the runtime for the integration test. This is because the way to import TLS/SSL certificate in the Java "cacerts" keystore is not supported for JDK11+.

Related issues and/or PRs

Changes made

  • For the CosmosDB CI, based on the integration test Java runtime version, it uses the correct syntax to import TLS/SSL certificate in the Java "cacerts" keystore.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

N/A

@Torch3333 Torch3333 self-assigned this Jun 18, 2024
# Conflicts:
#	.github/workflows/ci.yaml
@Torch3333 Torch3333 force-pushed the fix_cosmos_ci_for_jdk11+ branch from f4f0b30 to 5443770 Compare June 19, 2024 07:32
@Torch3333 Torch3333 changed the title Fix CosmosDB CI when running integration test for JDK11+ Fix CosmosDB CI when running integration test with JDK11+ Jun 19, 2024
@Torch3333 Torch3333 marked this pull request as ready for review June 19, 2024 08:05
& ${env:JAVA_HOME}/bin/keytool.exe -keystore ${env:JAVA_HOME}/jre/lib/security/cacerts -storepass 'changeit' -list -alias cosmos_emulator
# Setting the keystore option differs between Java 8 and Java 11+
if ( ${env:INT_TEST_JAVA_RUNTIME_VERSION} -eq '8' ) {
$keystore = "-keystore", "${env:JAVA_HOME}/jre/lib/security/cacerts"
Copy link
Contributor Author

@Torch3333 Torch3333 Jun 19, 2024

Choose a reason for hiding this comment

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

Suggested change
$keystore = "-keystore", "${env:JAVA_HOME}/jre/lib/security/cacerts"
$keystore = "-keystore ${env:JAVA_HOME}/jre/lib/security/cacerts"

Writing this variable as a single string will not expand correctly in Powershell because it does not recognize -keystore as being an option for the keytool.exe command.
Instead, we need to separate the option from its value by storing it as an array in the $keystore variable.
It took me some time to figure it out 😓

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!!

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@feeblefakie feeblefakie merged commit e0d7efa into master Jun 19, 2024
@feeblefakie feeblefakie deleted the fix_cosmos_ci_for_jdk11+ branch June 19, 2024 12:13
@Torch3333 Torch3333 added the github_actions Pull requests that update GitHub Actions code label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants