Skip to content

Commit

Permalink
Merge branch 'master' into SNOW-731500-jdbc-connectivity-diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-wfateem committed Jul 2, 2024
2 parents 6c50b6a + d4504f8 commit 44c299c
Show file tree
Hide file tree
Showing 62 changed files with 1,920 additions and 445 deletions.
51 changes: 40 additions & 11 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,51 @@ jobs:
WHITESOURCE_API_KEY: ${{ secrets.WHITESOURCE_API_KEY }}
run: ./ci/build.sh

test-windows:
needs: build
name: ${{ matrix.runConfig.cloud }} Windows java ${{ matrix.runConfig.javaVersion }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
runConfig: [ {cloud: 'AWS', javaVersion: '8'}, {cloud: 'GCP', javaVersion: '11'}, {cloud: 'AZURE', javaVersion: '17'}, {cloud: 'AWS', javaVersion: '21'}]
category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader,TestCategoryDiagnostic', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.runConfig.javaVersion }}
distribution: 'temurin'
cache: maven
- uses: actions/setup-python@v4
with:
python-version: '3.7'
architecture: 'x64'
- name: Tests
shell: cmd
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.runConfig.cloud }}
JDBC_TEST_CATEGORY: ${{ matrix.category }}
ADDITIONAL_MAVEN_PROFILE: ${{ matrix.additionalMavenProfile }}
run: ci\\test_windows.bat

test-mac:
needs: build
name: ${{ matrix.cloud }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }} / Test on Mac(java ${{ matrix.javaVersion }}, ${{ matrix.cloud }} )
name: ${{ matrix.runConfig.cloud }} Mac java ${{ matrix.runConfig.javaVersion }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }}
runs-on: macos-13
strategy:
fail-fast: false
matrix:
cloud: [ 'AWS' ]
javaVersion: [ '8', '11', '17']
category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
additionalMavenProfile: ['', '-Dthin-jar']
runConfig: [ {cloud: 'AWS', javaVersion: '8'}, {cloud: 'GCP', javaVersion: '11'}, {cloud: 'AZURE', javaVersion: '17'}, {cloud: 'AWS', javaVersion: '21'}]
category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader,TestCategoryDiagnostic', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
additionalMavenProfile: ['']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.javaVersion }}
java-version: ${{ matrix.runConfig.javaVersion }}
distribution: 'temurin'
cache: maven
- uses: actions/setup-python@v4
Expand All @@ -64,21 +93,21 @@ jobs:
shell: bash
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.cloud }}
CLOUD_PROVIDER: ${{ matrix.runConfig.cloud }}
JDBC_TEST_CATEGORY: ${{ matrix.category }}
ADDITIONAL_MAVEN_PROFILE: ${{ matrix.additionalMavenProfile }}
run: /usr/local/bin/bash ./ci/test_mac.sh

test-linux:
needs: build
name: ${{ matrix.cloud }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }} on ${{ matrix.image }}
name: ${{ matrix.cloud }} Linux java on ${{ matrix.image }} JDBC${{ matrix.additionalMavenProfile }} ${{ matrix.category }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [ 'jdbc-centos7-openjdk8', 'jdbc-centos7-openjdk11', 'jdbc-centos7-openjdk17' ]
cloud: [ 'AWS' ]
category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
image: [ 'jdbc-centos7-openjdk8', 'jdbc-centos7-openjdk11', 'jdbc-centos7-openjdk17', 'jdbc-centos7-openjdk21' ]
cloud: [ 'AWS', 'AZURE', 'GCP' ]
category: ['TestCategoryResultSet,TestCategoryOthers,TestCategoryLoader,TestCategoryDiagnostic', 'TestCategoryConnection,TestCategoryStatement', 'TestCategoryArrow,TestCategoryCore', 'TestCategoryFips']
additionalMavenProfile: ['', '-Dthin-jar']
steps:
- uses: actions/checkout@v1
Expand Down
Binary file added .github/workflows/parameters_azure.json.gpg
Binary file not shown.
46 changes: 29 additions & 17 deletions FIPS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,23 +323,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.plugin.exec}</version>
<executions>
<execution>
<id>check-shaded-content</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/scripts/check_content.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
Expand Down Expand Up @@ -662,6 +645,35 @@
</plugins>
</build>
</profile>
<profile>
<id>check-content</id>
<activation>
<os>
<family>!windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.plugin.exec}</version>
<executions>
<execution>
<id>check-shaded-content</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/scripts/check_content.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java-9</id>
<activation>
Expand Down
12 changes: 12 additions & 0 deletions FIPS/src/test/java/net/snowflake/client/RunningOnGCP.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2012-2024 Snowflake Computing Inc. All right reserved.
*/
package net.snowflake.client;

/** Run tests only on specified cloud provider or ignore */
public class RunningOnGCP implements ConditionalIgnoreRule.IgnoreCondition {
public boolean isSatisfied() {
String cloudProvider = TestUtil.systemGetEnv("CLOUD_PROVIDER");
return cloudProvider != null && cloudProvider.equalsIgnoreCase("GCP");
}
}
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.net.ssl.HttpsURLConnection;
import net.snowflake.client.AbstractDriverIT;
import net.snowflake.client.ConditionalIgnoreRule;
import net.snowflake.client.RunningOnGCP;
import net.snowflake.client.RunningOnGithubActions;
import net.snowflake.client.category.TestCategoryFips;
import net.snowflake.client.core.SecurityUtil;
Expand Down Expand Up @@ -289,7 +290,12 @@ public void testConnectUsingKeyPair() throws Exception {
DriverManager.getConnection(uri, properties).close();
}

/**
* Test case for connecting with FIPS and executing a query.
* Currently ignored execution on GCP due to exception thrown "SSlException Could not generate XDH keypair"
*/
@Test
@ConditionalIgnoreRule.ConditionalIgnore(condition = RunningOnGCP.class)
public void connectWithFipsAndQuery() throws SQLException {
try (Connection con = getConnection()) {
Statement statement = con.createStatement();
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ timestamps {
e.printStackTrace()
}

jdkToParams = ['openjdk8': 'jdbc-centos7-openjdk8', 'openjdk11': 'jdbc-centos7-openjdk11', 'openjdk17': 'jdbc-centos7-openjdk17'].collectEntries { jdk, image ->
jdkToParams = ['openjdk8': 'jdbc-centos7-openjdk8', 'openjdk11': 'jdbc-centos7-openjdk11', 'openjdk17': 'jdbc-centos7-openjdk17', 'openjdk21': 'jdbc-centos7-openjdk21'].collectEntries { jdk, image ->
return [(jdk): [
string(name: 'client_git_branch', value: scmInfo.GIT_BRANCH),
string(name: 'client_git_commit', value: scmInfo.GIT_COMMIT),
Expand Down
5 changes: 4 additions & 1 deletion ci/_init.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/local/bin/env bash
set -e

export PLATFORM=$(echo $(uname) | tr '[:upper:]' '[:lower:]')
Expand All @@ -23,18 +23,21 @@ declare -A TEST_IMAGE_NAMES=(
[$DRIVER_NAME-centos7-openjdk8]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-centos7-openjdk8-test:$TEST_IMAGE_VERSION
[$DRIVER_NAME-centos7-openjdk11]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-centos7-openjdk11-test:$TEST_IMAGE_VERSION
[$DRIVER_NAME-centos7-openjdk17]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-centos7-openjdk17-test:$TEST_IMAGE_VERSION
[$DRIVER_NAME-centos7-openjdk21]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-centos7-openjdk21-test:$TEST_IMAGE_VERSION
)
export TEST_IMAGE_NAMES

declare -A TEST_IMAGE_DOCKERFILES=(
[$DRIVER_NAME-centos7-openjdk8]=jdbc-centos7-openjdk-test
[$DRIVER_NAME-centos7-openjdk11]=jdbc-centos7-openjdk-test
[$DRIVER_NAME-centos7-openjdk17]=jdbc-centos7-openjdk-test
[$DRIVER_NAME-centos7-openjdk21]=jdbc-centos7-openjdk-test
)

declare -A TEST_IMAGE_BUILD_ARGS=(
[$DRIVER_NAME-centos7-openjdk8]="--target jdbc-centos7-openjdk-yum --build-arg=JDK_PACKAGE=java-1.8.0-openjdk-devel"
[$DRIVER_NAME-centos7-openjdk11]="--target jdbc-centos7-openjdk-yum --build-arg=JDK_PACKAGE=java-11-openjdk-devel" # pragma: allowlist secret
[$DRIVER_NAME-centos7-openjdk17]="--target jdbc-centos7-openjdk17"
[$DRIVER_NAME-centos7-openjdk21]="--target jdbc-centos7-openjdk21"
)

20 changes: 19 additions & 1 deletion ci/image/Dockerfile.jdbc-centos7-openjdk-test
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,22 @@ RUN export JAVA_HOME=/opt/jdk-17 && \
-Dnot-self-contained-jar \
--batch-mode --fail-never compile && \
mv $HOME/.m2 /home/user && \
chmod -R 777 /home/user/.m2
chmod -R 777 /home/user/.m2

###### OpenJDK 21 from archive (not available in yum)
FROM jdbc-centos7-openjdk-base AS jdbc-centos7-openjdk21

# Java
RUN curl -o - https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-x64_bin.tar.gz | tar xfz - -C /opt && \
ln -s /opt/jdk-21.0.2 /opt/jdk-21

RUN sed -i /usr/local/bin/entrypoint.sh -e '/^exec/i export JAVA_HOME=/opt/jdk-21'
RUN sed -i /usr/local/bin/entrypoint.sh -e '/^exec/i export PATH=$JAVA_HOME/bin:$PATH'

RUN export JAVA_HOME=/opt/jdk-21 && \
cd /root && \
mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dnot-self-contained-jar \
--batch-mode --fail-never compile && \
mv $HOME/.m2 /home/user && \
chmod -R 777 /home/user/.m2
1 change: 1 addition & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ for name in "${!TARGET_TEST_IMAGES[@]}"; do
-e BUILD_NUMBER \
-e JDBC_TEST_CATEGORY \
-e ADDITIONAL_MAVEN_PROFILE \
-e CLOUD_PROVIDER \
-e is_old_driver \
--add-host=snowflake.reg.local:${IP_ADDR} \
--add-host=s3testaccount.reg.local:${IP_ADDR} \
Expand Down
Loading

0 comments on commit 44c299c

Please sign in to comment.