Skip to content

Commit d83699b

Browse files
authored
chore(jdbc): add nightly JAR build (#4076)
1 parent 6b4081d commit d83699b

File tree

4 files changed

+120
-107
lines changed

4 files changed

+120
-107
lines changed

.cloudbuild/jdbc_nightly.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ steps:
3535
args: ['.kokoro/build.sh']
3636
env:
3737
- 'JOB_TYPE=jdbc-nightly-integration'
38+
- name: 'gcr.io/cloud-devrel-public-resources/java11'
39+
id: "Nightly build"
40+
timeout: 10000s
41+
entrypoint: 'bash'
42+
args: ['.kokoro/jdbc-release.sh']
43+
env:
44+
- 'NIGHTLY_RELEASE_GCS_BUCKET=$_NIGHTLY_RELEASE_GCS_BUCKET'
3845

3946
availableSecrets:
4047
secretManager:

.kokoro/jdbc-release.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -euo pipefail
17+
18+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
19+
cd "${DIR}/../google-cloud-bigquery-jdbc"
20+
21+
FOLDER="$(pwd)/release"
22+
DATE=$(date '+%Y-%m-%d')
23+
COMMIT=$(git rev-parse --short HEAD)
24+
PACKAGE="google-cloud-bigquery-jdbc"
25+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
26+
BUCKET=${NIGHTLY_RELEASE_GCS_BUCKET}
27+
NIGHTLY_BUILD_DESTINATION="${BUCKET}/nightly/${VERSION}/${DATE}"
28+
29+
# All dependencies release
30+
mkdir -p "${FOLDER}"
31+
make docker-package PACKAGE_DESTINATION="${FOLDER}"
32+
NAME=${PACKAGE}-${VERSION}-${COMMIT}
33+
34+
gsutil cp -r "${FOLDER}/${PACKAGE}-${VERSION}.zip" "${NIGHTLY_BUILD_DESTINATION}/${NAME}.zip"
35+
gsutil cp -r "${FOLDER}/${PACKAGE}-${VERSION}-all.jar" "${NIGHTLY_BUILD_DESTINATION}/${NAME}-all.jar"
36+
37+
rm -rf "${FOLDER}"
38+
39+
# # Update latest version
40+
gsutil cp "${NIGHTLY_BUILD_DESTINATION}/${NAME}.zip" "${BUCKET}/${PACKAGE}-latest.zip"
41+
gsutil cp "${NIGHTLY_BUILD_DESTINATION}/${NAME}-all.jar" "${BUCKET}/${PACKAGE}-latest-all.jar"

google-cloud-bigquery-jdbc/Makefile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ package:
5959
-DincludeScope=runtime
6060
${MAKE} generate-dependency-list
6161

62-
package-all-dependencies:
63-
mvn package \
64-
-DincludeScope=runtime \
65-
-Dmaven.test.skip=true \
66-
-P=release-all-dependencies
67-
68-
package-all-dependencies-shaded:
69-
mvn package \
70-
-DincludeScope=runtime \
71-
-Dmaven.test.skip=true \
72-
-P=release-all-dependencies,release-all-dependencies-shaded
73-
7462
generate-dependency-list:
7563
mvn -B dependency:list \
7664
-f pom.xml \
@@ -123,11 +111,13 @@ docker-package: docker-build
123111
sh -c "make package && \
124112
mkdir -p /tmp/package && \
125113
cp --no-preserve=ownership /mvn/test-target/google-cloud-bigquery-jdbc-*.jar /tmp/package && \
126-
rm -f /pkg/*tests.jar && \
114+
rm -f /tmp/package/google-cloud-bigquery-jdbc-*-all.jar && \
115+
rm -f /tmp/package/*tests.jar && \
127116
cp --no-preserve=ownership dependencies.txt /tmp/package && \
128117
rm dependencies.txt && \
129118
cp --no-preserve=ownership /mvn/test-target/dependency/*.jar /tmp/package && \
130-
zip -j -r /pkg/google-cloud-bigquery-jdbc-$$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout).zip /tmp/package"
119+
zip -j -r /pkg/google-cloud-bigquery-jdbc-$$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout).zip /tmp/package && \
120+
cp --no-preserve=ownership /mvn/test-target/google-cloud-bigquery-jdbc-*-all.jar /pkg "
131121

132122
docker-unittest: |
133123
$(MAKE) .docker-run args="make unittest test=$(test)"

google-cloud-bigquery-jdbc/pom.xml

Lines changed: 68 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,74 @@
6767
</ignoredUsedUndeclaredDependencies>
6868
</configuration>
6969
</plugin>
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-shade-plugin</artifactId>
73+
<version>3.5.2</version> <!-- Use the latest version -->
74+
<executions>
75+
<execution>
76+
<phase>package</phase>
77+
<goals>
78+
<goal>shade</goal>
79+
</goals>
80+
<configuration>
81+
<shadedArtifactAttached>true</shadedArtifactAttached>
82+
<shadedClassifierName>all</shadedClassifierName> <!-- Any name that makes sense -->
83+
<createDependencyReducedPom>false</createDependencyReducedPom>
84+
<archive>
85+
<manifestEntries>
86+
<Add-Opens>java.base/java.nio=ALL-UNNAMED</Add-Opens>
87+
</manifestEntries>
88+
</archive>
89+
<transformers>
90+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
91+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
92+
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
93+
<resource>META-INF/io.netty.versions.properties</resource>
94+
</transformer>
95+
</transformers>
96+
<relocations>
97+
<relocation>
98+
<pattern>com</pattern>
99+
<shadedPattern>com.google.bqjdbc.shaded.com</shadedPattern>
100+
<excludes>
101+
<exclude>com.google.cloud.bigquery.*</exclude>
102+
<exclude>com.google.cloud.bigquery.jdbc.*</exclude>
103+
</excludes>
104+
</relocation>
105+
<relocation>
106+
<pattern>org</pattern>
107+
<shadedPattern>com.google.bqjdbc.shaded.org</shadedPattern>
108+
<excludes>
109+
<exclude>org.conscrypt.*</exclude>
110+
</excludes>
111+
</relocation>
112+
<relocation>
113+
<pattern>io</pattern>
114+
<shadedPattern>com.google.bqjdbc.shaded.io</shadedPattern>
115+
</relocation>
116+
</relocations>
117+
<filters>
118+
<filter>
119+
<artifact>*:*</artifact>
120+
<excludes>
121+
<exclude>META-INF/LICENSE*</exclude>
122+
<exclude>META-INF/NOTICE*</exclude>
123+
<exclude>META-INF/DEPENDENCIES</exclude>
124+
<exclude>META-INF/proguard/*.pro</exclude>
125+
<exclude>META-INF/maven/**</exclude>
126+
<exclude>META-INF/*.MF</exclude>
127+
<exclude>META-INF/*.SF</exclude>
128+
<exclude>META-INF/*.DSA</exclude>
129+
<exclude>META-INF/*.RSA</exclude>
130+
<exclude>arrow-git.properties</exclude>
131+
</excludes>
132+
</filter>
133+
</filters>
134+
</configuration>
135+
</execution>
136+
</executions>
137+
</plugin>
70138
</plugins>
71139
</build>
72140

@@ -236,99 +304,6 @@
236304
</build>
237305
</profile>
238306

239-
<!-- Profile used to build JAR with all dependencies for the release. -->
240-
<profile>
241-
<id>release-all-dependencies-shaded</id>
242-
<build>
243-
<plugins>
244-
<plugin>
245-
<groupId>org.apache.maven.plugins</groupId>
246-
<artifactId>maven-shade-plugin</artifactId>
247-
<version>3.5.2</version> <!-- Use the latest version -->
248-
<executions>
249-
<execution>
250-
<configuration>
251-
<relocations>
252-
<relocation>
253-
<pattern>com</pattern>
254-
<shadedPattern>shaded.bqjdbc.com</shadedPattern>
255-
<excludes>
256-
<exclude>com.google.cloud.bigquery.jdbc.*</exclude>
257-
</excludes>
258-
</relocation>
259-
<relocation>
260-
<pattern>org</pattern>
261-
<shadedPattern>shaded.bqjdbc.org</shadedPattern>
262-
<excludes>
263-
<exclude>org.conscrypt.*</exclude>
264-
</excludes>
265-
</relocation>
266-
<relocation>
267-
<pattern>io</pattern>
268-
<shadedPattern>shaded.bqjdbc.io</shadedPattern>
269-
</relocation>
270-
</relocations>
271-
</configuration>
272-
</execution>
273-
</executions>
274-
</plugin>
275-
</plugins>
276-
</build>
277-
</profile>
278-
279-
<profile>
280-
<id>release-all-dependencies</id>
281-
<build>
282-
<plugins>
283-
<plugin>
284-
<groupId>org.apache.maven.plugins</groupId>
285-
<artifactId>maven-shade-plugin</artifactId>
286-
<version>3.5.2</version> <!-- Use the latest version -->
287-
<executions>
288-
<execution>
289-
<phase>package</phase>
290-
<goals>
291-
<goal>shade</goal>
292-
</goals>
293-
<configuration>
294-
<createDependencyReducedPom>false</createDependencyReducedPom>
295-
<archive>
296-
<manifestEntries>
297-
<Add-Opens>java.base/java.nio=ALL-UNNAMED</Add-Opens>
298-
</manifestEntries>
299-
</archive>
300-
<transformers>
301-
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
302-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
303-
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
304-
<resource>META-INF/io.netty.versions.properties</resource>
305-
</transformer>
306-
</transformers>
307-
<filters>
308-
<filter>
309-
<artifact>*:*</artifact>
310-
<excludes>
311-
<exclude>META-INF/LICENSE*</exclude>
312-
<exclude>META-INF/NOTICE*</exclude>
313-
<exclude>META-INF/DEPENDENCIES</exclude>
314-
<exclude>META-INF/proguard/*.pro</exclude>
315-
<exclude>META-INF/maven/**</exclude>
316-
<exclude>META-INF/*.MF</exclude>
317-
<exclude>META-INF/*.SF</exclude>
318-
<exclude>META-INF/*.DSA</exclude>
319-
<exclude>META-INF/*.RSA</exclude>
320-
<exclude>arrow-git.properties</exclude>
321-
</excludes>
322-
</filter>
323-
</filters>
324-
</configuration>
325-
</execution>
326-
</executions>
327-
</plugin>
328-
</plugins>
329-
</build>
330-
</profile>
331-
332307
<!-- Profile used inside docker -->
333308
<profile>
334309
<id>docker</id>

0 commit comments

Comments
 (0)