Skip to content

Commit

Permalink
Merge branch 'master' into update-sigv4-library
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazcy authored Jan 29, 2024
2 parents 5a10bfe + 3b8e16e commit 50ba5b8
Show file tree
Hide file tree
Showing 21 changed files with 153 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
# For more info on specifying custom build steps, see:
# https://docs.github.com/en/[email protected]/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language
- name: Build java
run: mvn clean package -T 1C -DskipTests
run: mvn clean package -T 1C -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN --no-transfer-progress
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/cut_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Build Java 11 jars
run: |
mvn clean package -T 1C -DskipTests
mvn clean package -T 1C -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN --no-transfer-progress
# Copy over the sdk jars
mkdir -p /tmp/java11_sdk_jars/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javadoc_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
java-version: '11'

- name: Build Javadoc with Maven
run: mvn -B javadoc:aggregate --file pom.xml
run: mvn -B javadoc:aggregate --file pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN --no-transfer-progress

- name: Switch to gh-pages branch
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
run: mvn -B clean package -T 1C --file pom.xml -Dmaven.compiler.release=8
run: mvn -B clean package -T 1C --file pom.xml -Dmaven.compiler.release=8 -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN --no-transfer-progress
# Identify if any files were modified as a result of running maven build.
- name: Identify any Maven Build changes
run: >
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run_release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ jobs:
with:
fetch-depth: 0
- name: Build jars
run: mvn clean package -T 1C -DskipTests
run: mvn clean package -T 1C -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN --no-transfer-progress
- name: Setup Repo Root Directory
run: echo "REPOSITORY_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Setup AWS Cred
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-duration-seconds: 18000
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
- name: Run tests
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ node_modules
package-lock.json
cdk.out
.env
**/*.dylib
2 changes: 1 addition & 1 deletion athena-elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>8.11.3</version>
<version>8.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-high-level-client -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion athena-federation-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.3.0</version>
<version>2.4.0</version>
<configuration>
<verbose>false</verbose>
<addSvnKeyWords>false</addSvnKeyWords>
Expand Down
2 changes: 1 addition & 1 deletion athena-gcs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.30.1</version>
<version>2.32.1</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions athena-google-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigquery</artifactId>
<version>2.35.0</version>
<version>2.37.0</version>
<exclusions>
<exclusion>
<groupId>com.google.api.grpc</groupId>
Expand All @@ -70,12 +70,12 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-resourcemanager</artifactId>
<version>1.34.0</version>
<version>1.36.0</version>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.15.5</version>
<version>3.15.6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion athena-msk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<dependency>
<groupId>software.amazon.msk</groupId>
<artifactId>aws-msk-iam-auth</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<exclusions>
<exclusion>
<groupId>com.amazonaws</groupId>
Expand Down
2 changes: 1 addition & 1 deletion athena-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
<version>8.3.0</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
Expand Down
2 changes: 1 addition & 1 deletion athena-neptune/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-repository-sparql</artifactId>
<version>3.6.3</version>
<version>3.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
2 changes: 1 addition & 1 deletion athena-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>6.3.0.RELEASE</version>
<version>6.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
2 changes: 1 addition & 1 deletion athena-redshift/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.amazon.redshift</groupId>
<artifactId>redshift-jdbc42</artifactId>
<version>2.1.0.24</version>
<version>2.1.0.25</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
Expand Down
31 changes: 31 additions & 0 deletions athena-snowflake/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<!-- Make sure the ZIP contents are not nested in a subdirectory -->
<includeBaseDirectory>false</includeBaseDirectory>

<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}/conf</directory>
</fileSet>
<!-- Include the compiled classes as-is and put them in the root of the ZIP -->
<fileSet>
<directory>${project.build.directory}/classes</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>false</useTransitiveDependencies>
<excludes>
<exclude>${project.groupId}:${project.artifactId}:jar:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
2 changes: 1 addition & 1 deletion athena-snowflake/athena-snowflake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Resources:
default: !Ref DefaultConnectionString
FunctionName: !Ref LambdaFunctionName
Handler: "com.amazonaws.athena.connectors.snowflake.SnowflakeMuxCompositeHandler"
CodeUri: "./target/athena-snowflake-2022.47.1.jar"
CodeUri: "./target/athena-snowflake.zip"
Description: "Enables Amazon Athena to communicate with Snowflake using JDBC"
Runtime: java11
Timeout: !Ref LambdaTimeout
Expand Down
40 changes: 11 additions & 29 deletions athena-snowflake/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>net.snowflake</groupId>
<artifactId>snowflake-jdbc</artifactId>
<version>3.14.4</version>
<version>3.14.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-rds -->
<dependency>
Expand Down Expand Up @@ -68,39 +68,21 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${mvn.shade.plugin.version}</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<!-- This transformer is here to concatenate log4j2 cache during shading -->
<transformer implementation="com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer">
</transformer>
</transformers>
</configuration>
<dependencies>
<dependency>
<groupId>com.github.edwgiz</groupId>
<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
<version>${log4j2.cachefile.transformer.version}</version>
</dependency>
</dependencies>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<finalName>${project.artifactId}</finalName>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
<!--<maven.compiler.release>8</maven.compiler.release>-->
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.plugin.version>3.12.1</maven.compiler.plugin.version>
<aws-sdk.version>1.12.632</aws-sdk.version>
<aws-sdk.version>1.12.646</aws-sdk.version>
<aws.lambda-java-core.version>1.2.2</aws.lambda-java-core.version>
<aws.lambda-java-log4j2.version>1.6.0</aws.lambda-java-log4j2.version>
<aws-cdk.version>1.204.0</aws-cdk.version>
<jsii.version>1.93.0</jsii.version>
<slf4j-log4j.version>2.0.10</slf4j-log4j.version>
<jsii.version>1.94.0</jsii.version>
<slf4j-log4j.version>2.0.11</slf4j-log4j.version>
<mockito.version>4.11.0</mockito.version>
<junit.version>4.13.2</junit.version>
<jqwik.version>1.8.2</jqwik.version>
<assertj.version>3.25.1</assertj.version>
<assertj.version>3.25.2</assertj.version>
<testng.version>7.9.0</testng.version>
<fasterxml.jackson.version>2.16.1</fasterxml.jackson.version>
<surefire.failsafe.version>3.2.3</surefire.failsafe.version>
<surefire.failsafe.version>3.2.5</surefire.failsafe.version>
<log4j2Version>2.22.1</log4j2Version>
<apache.arrow.version>13.0.0</apache.arrow.version>
<guava.version>33.0.0-jre</guava.version>
<protobuf3.version>3.25.1</protobuf3.version>
<protobuf3.version>3.25.2</protobuf3.version>
<antlr.st4.version>4.3.4</antlr.st4.version>
<log4j2.cachefile.transformer.version>2.15</log4j2.cachefile.transformer.version>
<apache.httpclient.version>4.5.14</apache.httpclient.version>
Expand Down Expand Up @@ -287,7 +287,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.3.0</version>
<version>2.4.0</version>
<configuration>
<verbose>false</verbose>
<addSvnKeyWords>false</addSvnKeyWords>
Expand Down
10 changes: 10 additions & 0 deletions validation_testing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ def assert_required_env_vars_set():
if not all([os.environ.get(env_var) for env_var in required_env_vars]):
raise RuntimeError("not all expected environment variables were set!")

def pre_test_infra_check():
# Responsible for making sure that all stacks from previous runs are cleaned
# This is needed as sometimes we have resources that are stuck around after tests
# That makes the stack deletion impossible, such as ENIs.
# This will ensure that everything is cleaned up before bringing up a new stack
for connector in TESTABLE_CONNECTORS:
shell_command = f'sh run_cleanup_infra.sh {connector}'
subprocess.run(shell_command, shell=True, check=True)

if __name__ == '__main__':
assert_required_env_vars_set()
pre_test_infra_check()
run_all_connector_release_tests()
75 changes: 75 additions & 0 deletions validation_testing/run_cleanup_infra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
CONNECTOR_NAME=$1
VALIDATION_TESTING_ROOT=$REPOSITORY_ROOT/validation_testing

# go to cdk dir, build/synth/deploy
cd $(dirname $(find . -name ATHENA_INFRA_SPINUP_ROOT))/app;

cat <<EOF > .env
DATABASE_PASSWORD=$DATABASE_PASSWORD
S3_DATA_PATH=$S3_PATH
REPOSITORY_ROOT=$REPOSITORY_ROOT
EOF

# cd back to validation root
cd $VALIDATION_TESTING_ROOT

### There are few objects that need to be cleaned up manually before attempting to destroy the stack:
# 1- ENIs (Affects Postgresql Stack mostly)
# 2- Redhisft Spill bucket can't be deleted because its not empty (Redshift)
# 3- Redshift Parameter Group is required to be cleaned up manually as well

#### STEP 1:
# Glue attaches ENIs to the VPC subnet, if there is one, in order to connect to the VPC, and then will issue a delete of them later, but if they aren't finished deleting by the time we invoke cdk destroy,
# CFN will not know about the resources and not be able to delete the stack. So, we proactively look for and delete ENIs attached to glue ourselves first
echo "STEP 1: CLEANING UP ANY ENIs"
aws ec2 describe-subnets --filters "Name=tag:Name,Values=${CONNECTOR_NAME}CdkStack*" | jq ".Subnets[].SubnetId" | tr -d '"' \
| xargs -n 1 -I {} aws ec2 describe-network-interfaces --filters "Name=subnet-id,Values={}" | jq ".NetworkInterfaces[] | select(.Description | startswith(\"Attached to Glue\")) | .NetworkInterfaceId" | tr -d '"' \
| xargs -I {} aws ec2 delete-network-interface --network-interface-id {}


#### STEP 2:
# Cleanup any stack specific S3 bucket:

# List and filter buckets
echo "STEP 2: CLEANING UP ANY S3 RESDUE BUCKETS"
buckets=$(aws s3 ls | grep ${CONNECTOR_NAME}cdkstack | awk '{print $3}')

# Loop through each bucket
for bucket in $buckets; do
echo "Emptying bucket $bucket"
aws s3 rm s3://$bucket --recursive --quiet

echo "Deleting bucket $bucket"
aws s3 rb s3://$bucket
done

#### STEP3:
# Cleanup Redshift Parameter group
# #todo: this is results in latest changes of redshift construct
# We need to move back to L2 contruct, once its fixed
echo "STEP 3: CLEANING UP ANY REDSHIFT PARAMETER GROUP"
if [ "${CONNECTOR_NAME}" = "redshift" ]; then
aws redshift delete-cluster-parameter-group -- delete-cluster-parameter-group caseinsensitiveparametername
fi

# once that is done, we can delete our CDK stack if it exists.
cd $(dirname $(find . -name ATHENA_INFRA_SPINUP_ROOT))/app;
prefix="${CONNECTOR_NAME}CdkStack"

npm install;
npm run build;
npm run cdk synth;
yes | npm run cdk destroy ${CONNECTOR_NAME}CdkStack;

# Check if the stack is clean up -- Otherwise fail so that On-Call can manually clean up the stack.
stacks=$(aws cloudformation list-stacks --stack-status-filter CREATE_FAILED ROLLBACK_FAILED DELETE_IN_PROGRESS DELETE_FAILED | jq -r --arg prefix "$prefix" '.StackSummaries[] | select(.StackName | startswith($prefix)) | .StackName')
if [ -z "$stacks" ]; then
echo "FINISHED CLEANING UP RESOURCES FOR ${CONNECTOR_NAME}."
# cd back to validation root
cd $VALIDATION_TESTING_ROOT
exit 0
else
echo "FINISHED CLEANING UP RESOURCES FOR ${CONNECTOR_NAME}."
echo "PLEASE CLEAN UP RESOURCES FOR THE STACK MANUALLY."
exit 1
fi

0 comments on commit 50ba5b8

Please sign in to comment.