From db197277f04346e7b336712d25b5899b3f6add36 Mon Sep 17 00:00:00 2001 From: Eno Compton Date: Mon, 28 Aug 2023 11:10:32 -0600 Subject: [PATCH 1/4] docs: add region tags for hikaricp config (#86) --- ...AlloyDbJdbcConnectorDataSourceFactory.java | 41 +++++++++++++++++++ .../cloud/alloydb/ITSocketFactoryTest.java | 11 +---- 2 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/AlloyDbJdbcConnectorDataSourceFactory.java diff --git a/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/AlloyDbJdbcConnectorDataSourceFactory.java b/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/AlloyDbJdbcConnectorDataSourceFactory.java new file mode 100644 index 00000000..ebc59709 --- /dev/null +++ b/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/AlloyDbJdbcConnectorDataSourceFactory.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.alloydb; + +// [START alloydb_hikaricp_connect_connector] +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; + +public class AlloyDbJdbcConnectorDataSourceFactory { + + public static final String ALLOYDB_USER = System.getenv("ALLOYDB_USER"); + public static final String ALLOYDB_PASS = System.getenv("ALLOYDB_PASS"); + public static final String ALLOYDB_INSTANCE_NAME = System.getenv("ALLOYDB_INSTANCE_NAME"); + + static HikariDataSource createDataSource() { + HikariConfig config = new HikariConfig(); + + config.setJdbcUrl("jdbc:postgresql:///postgres"); + config.setUsername(ALLOYDB_USER); // e.g., "postgres" + config.setPassword(ALLOYDB_PASS); // e.g., "secret-password" + config.addDataSourceProperty("socketFactory", "com.google.cloud.alloydb.SocketFactory"); + // e.g., "projects/my-project/locations/us-central1/clusters/my-cluster/instances/my-instance" + config.addDataSourceProperty("alloydbInstanceName", ALLOYDB_INSTANCE_NAME); + + return new HikariDataSource(config); + } +} +// [END alloydb_hikaricp_connect_connector] diff --git a/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/ITSocketFactoryTest.java b/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/ITSocketFactoryTest.java index 5403de31..5f9e45a3 100644 --- a/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/ITSocketFactoryTest.java +++ b/alloydb-jdbc-connector/src/test/java/com/google/cloud/alloydb/ITSocketFactoryTest.java @@ -19,7 +19,6 @@ import com.google.common.collect.BoundType; import com.google.common.collect.Range; -import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import java.sql.Connection; import java.sql.PreparedStatement; @@ -38,15 +37,7 @@ public class ITSocketFactoryTest { @Before public void setUp() { - HikariConfig config = new HikariConfig(); - - config.setJdbcUrl("jdbc:postgresql:///postgres"); - config.setUsername(System.getenv("ALLOYDB_USER")); - config.setPassword(System.getenv("ALLOYDB_PASS")); - config.addDataSourceProperty("socketFactory", "com.google.cloud.alloydb.SocketFactory"); - config.addDataSourceProperty("alloydbInstanceName", System.getenv("ALLOYDB_INSTANCE_NAME")); - - this.dataSource = new HikariDataSource(config); + this.dataSource = AlloyDbJdbcConnectorDataSourceFactory.createDataSource(); } @After From 7553a91a4ec64550abf0b66da71677cdced6a632 Mon Sep 17 00:00:00 2001 From: Eno Compton Date: Wed, 30 Aug 2023 11:04:17 -0600 Subject: [PATCH 2/4] chore: Update blunderbuss.yml (#89) --- .github/blunderbuss.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 03b37060..ea07b81e 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -13,9 +13,8 @@ # limitations under the License. assign_issues: - - enocom - + - ttosta-google assign_prs: - enocom - - hessjcg + - ttosta-google From d384d06f64041bef866bc0519556aae56776bd39 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 31 Aug 2023 16:37:46 +0200 Subject: [PATCH 3/4] deps: update actions/github-script action to v6.4.1 (#48) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5e287986..7e6e85f3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -195,7 +195,7 @@ jobs: steps: - name: Remove PR label if: "${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}" - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From 578de569633d657def58a7a146474dee3724557e Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 31 Aug 2023 16:45:45 +0200 Subject: [PATCH 4/4] deps: update actions/checkout action to v3.6.0 (#47) --- .github/workflows/ci.yaml | 12 ++++++------ .github/workflows/labels.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e6e85f3..ff8ab97f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,7 +31,7 @@ jobs: matrix: java: [8, 11, 17] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} @@ -48,7 +48,7 @@ jobs: steps: - name: Support longpaths run: git config --system core.longpaths true - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} @@ -66,7 +66,7 @@ jobs: matrix: java: [8, 11, 17] steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} @@ -79,7 +79,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} @@ -94,7 +94,7 @@ jobs: clirr: runs-on: ubuntu-latest steps: - - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} @@ -211,7 +211,7 @@ jobs: } - name: Checkout code - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 with: ref: ${{ github.event.pull_request.head.sha }} repository: ${{ github.event.pull_request.head.repo.full_name }} diff --git a/.github/workflows/labels.yaml b/.github/workflows/labels.yaml index ad4ead45..45893e99 100644 --- a/.github/workflows/labels.yaml +++ b/.github/workflows/labels.yaml @@ -28,7 +28,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}