diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index cd30688c3..22b57b8ba 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "9b445423a213309ad8dea9b149c3511c82174f6d" + "sha": "bc6075b1eefaf9a65fc5f4d27ab8a7b76d499d35" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "043cc620d6a6111816d9e09f2a97208565fde958" + "sha": "a648ce0ca3fe122b3186d7e6861cb641437e485e" } } ] diff --git a/.github/release-please.yml b/.github/release-please.yml index dce2c8450..807174cce 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,6 @@ releaseType: java-yoshi -bumpMinorPreMajor: true \ No newline at end of file +bumpMinorPreMajor: true +branches: +- releaseType: java-lts + bumpMinorPreMajor: true + branch: 1.127.12-sp \ No newline at end of file diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index d72318bf6..ba8ff8a8d 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -38,6 +38,22 @@ branchProtectionRules: - "units (11)" - "Kokoro - Test: Integration" - "cla/google" +- pattern: 1.127.12-sp + isAdminEnforced: true + requiredApprovingReviewCount: 1 + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: false + requiredStatusCheckContexts: + - "dependencies (8)" + - "dependencies (11)" + - "linkage-monitor" + - "lint" + - "clirr" + - "units (7)" + - "units (8)" + - "units (11)" + - "Kokoro - Test: Integration" + - "cla/google" # List of explicit permissions to add (additive only) permissionRules: # Team slug to add to repository permissions diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index 59d2aafc7..12f1088d8 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -50,7 +50,9 @@ function completenessCheck() { # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) msg "Generating dependency list using flattened pom..." - mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + # Excluding commons-codec,commons-logging from the comparison as a temp fix + # Explanation and issue filed in maven-dependency-plugin: https://issues.apache.org/jira/browse/MDEP-737 + mvn dependency:list -f .flattened-pom.xml -DexcludeArtifactIds=commons-codec,commons-logging -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt # Compare two dependency lists msg "Comparing dependency lists..." diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc26ec21..d04399caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [1.128.2](https://www.github.com/googleapis/java-bigquery/compare/v1.128.1...v1.128.2) (2021-04-30) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigtable to v1.23.2 ([#1255](https://www.github.com/googleapis/java-bigquery/issues/1255)) ([bc6075b](https://www.github.com/googleapis/java-bigquery/commit/bc6075b1eefaf9a65fc5f4d27ab8a7b76d499d35)) +* update dependency com.google.cloud:google-cloud-storage to v1.113.16 ([#1259](https://www.github.com/googleapis/java-bigquery/issues/1259)) ([8c0b85b](https://www.github.com/googleapis/java-bigquery/commit/8c0b85b5b9a9661b10181587c29e819ee5b6a708)) + ### [1.128.1](https://www.github.com/googleapis/java-bigquery/compare/v1.128.0...v1.128.1) (2021-04-26) diff --git a/README.md b/README.md index 1808b5c8f..89fe693fe 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-bigquery - 1.128.0 + 1.128.1 ``` @@ -53,12 +53,12 @@ compile 'com.google.cloud:google-cloud-bigquery' ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-bigquery:1.128.0' +compile 'com.google.cloud:google-cloud-bigquery:1.128.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "1.128.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "1.128.1" ``` ## Authentication diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..8b58ae9c0 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/benchmark/pom.xml b/benchmark/pom.xml index f77964c10..21b212b14 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 1.128.1 + 1.128.2 diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 8c512d929..bae500efd 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 1.128.1 + 1.128.2 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 1.128.1 + 1.128.2 google-cloud-bigquery @@ -29,6 +29,14 @@ com.google.http-client google-http-client-jackson2 + + com.google.cloud + google-cloud-datacatalog + + + com.google.api.grpc + proto-google-cloud-datacatalog-v1 + com.google.cloud google-cloud-storage diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 4e8e600f7..e123fa446 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -59,6 +59,7 @@ import com.google.cloud.bigquery.ExternalTableDefinition; import com.google.cloud.bigquery.ExtractJobConfiguration; import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.FieldList; import com.google.cloud.bigquery.FieldValue; import com.google.cloud.bigquery.FieldValueList; import com.google.cloud.bigquery.FormatOptions; @@ -98,6 +99,12 @@ import com.google.cloud.bigquery.ViewDefinition; import com.google.cloud.bigquery.WriteChannelConfiguration; import com.google.cloud.bigquery.testing.RemoteBigQueryHelper; +import com.google.cloud.datacatalog.v1.CreatePolicyTagRequest; +import com.google.cloud.datacatalog.v1.CreateTaxonomyRequest; +import com.google.cloud.datacatalog.v1.PolicyTag; +import com.google.cloud.datacatalog.v1.PolicyTagManagerClient; +import com.google.cloud.datacatalog.v1.Taxonomy; +import com.google.cloud.datacatalog.v1.Taxonomy.PolicyType; import com.google.cloud.storage.BlobInfo; import com.google.cloud.storage.BucketInfo; import com.google.cloud.storage.Storage; @@ -155,10 +162,6 @@ public class ITBigQueryTest { ImmutableMap.of( "example-label1", "example-value1", "example-label2", "example-value2"); - private static final String sampleTag = - String.format("projects/%s/locations/us/taxonomies/1/policyTags/2", PROJECT_ID); - private static final PolicyTags POLICY_TAGS = - PolicyTags.newBuilder().setNames(ImmutableList.of(sampleTag)).build(); private static final Field TIMESTAMP_FIELD_SCHEMA = Field.newBuilder("TimestampField", LegacySQLTypeName.TIMESTAMP) .setMode(Field.Mode.NULLABLE) @@ -241,12 +244,6 @@ public class ITBigQueryTest { .setMode(Field.Mode.NULLABLE) .setDescription("BigNumeric4Description") .build(); - private static final Field STRING_FIELD_SCHEMA_WITH_POLICY = - Field.newBuilder("StringFieldWithPolicy", LegacySQLTypeName.STRING) - .setMode(Field.Mode.NULLABLE) - .setDescription("field has a policy") - .setPolicyTags(POLICY_TAGS) - .build(); private static final Schema TABLE_SCHEMA = Schema.of( TIMESTAMP_FIELD_SCHEMA, @@ -297,8 +294,6 @@ public class ITBigQueryTest { .build()); private static final Schema SIMPLE_SCHEMA = Schema.of(STRING_FIELD_SCHEMA); - private static final Schema POLICY_SCHEMA = - Schema.of(STRING_FIELD_SCHEMA, STRING_FIELD_SCHEMA_WITH_POLICY, INTEGER_FIELD_SCHEMA); private static final Schema QUERY_RESULT_SCHEMA = Schema.of( Field.newBuilder("TimestampField", LegacySQLTypeName.TIMESTAMP) @@ -705,18 +700,85 @@ public void testCreateTableWithRangePartitioning() { } } - public void testCreateTableWithPolicyTags() { - String tableName = "test_create_table_policytags"; - TableId tableId = TableId.of(DATASET, tableName); - try { + @Test + public void testCreateAndUpdateTableWithPolicyTags() throws IOException { + // Set up policy tags in the datacatalog service + try (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) { + CreateTaxonomyRequest createTaxonomyRequest = + CreateTaxonomyRequest.newBuilder() + .setParent(String.format("projects/%s/locations/%s", PROJECT_ID, "us")) + .setTaxonomy( + Taxonomy.newBuilder() + .setDisplayName("testing taxonomy") + .setDescription("taxonomy created for integration tests") + .addActivatedPolicyTypes(PolicyType.FINE_GRAINED_ACCESS_CONTROL) + .build()) + .build(); + Taxonomy taxonomyResponse = policyTagManagerClient.createTaxonomy(createTaxonomyRequest); + String taxonomyId = taxonomyResponse.getName(); + + CreatePolicyTagRequest createPolicyTagRequest = + CreatePolicyTagRequest.newBuilder() + .setParent(taxonomyId) + .setPolicyTag(PolicyTag.newBuilder().setDisplayName("ExamplePolicyTag").build()) + .build(); + PolicyTag policyTagResponse = policyTagManagerClient.createPolicyTag(createPolicyTagRequest); + String policyTagId = policyTagResponse.getName(); + PolicyTags policyTags = + PolicyTags.newBuilder().setNames(ImmutableList.of(policyTagId)).build(); + Field stringFieldWithPolicy = + Field.newBuilder("StringFieldWithPolicy", LegacySQLTypeName.STRING) + .setMode(Field.Mode.NULLABLE) + .setDescription("field has a policy") + .setPolicyTags(policyTags) + .build(); + Schema policySchema = + Schema.of(STRING_FIELD_SCHEMA, stringFieldWithPolicy, INTEGER_FIELD_SCHEMA); + + // Test: Amend an existing schema with a policy tag. + String tableNameForUpdate = "test_update_table_policytags"; + TableId tableIdForUpdate = TableId.of(DATASET, tableNameForUpdate); + TableInfo tableInfo = + TableInfo.newBuilder(tableIdForUpdate, StandardTableDefinition.of(TABLE_SCHEMA)) + .setDescription("policy tag update test table") + .build(); + Table createdTableForUpdate = bigquery.create(tableInfo); + assertNotNull(createdTableForUpdate); + Schema schema = createdTableForUpdate.getDefinition().getSchema(); + FieldList fields = schema.getFields(); + // Create a new schema adding the current fields, plus the new policy tag field + List fieldList = new ArrayList<>(); + for (Field field : fields) { + fieldList.add(field); + } + fieldList.add(stringFieldWithPolicy); + Schema updatedSchemaWithPolicyTag = Schema.of(fieldList); + Table updatedTable = + createdTableForUpdate + .toBuilder() + .setDefinition(StandardTableDefinition.of(updatedSchemaWithPolicyTag)) + .build(); + updatedTable.update(); + Table remoteUpdatedTable = bigquery.getTable(DATASET, tableNameForUpdate); + assertEquals( + updatedSchemaWithPolicyTag, + remoteUpdatedTable.getDefinition().getSchema()); + bigquery.delete(tableIdForUpdate); + + // Test: Create a new table with a policy tag defined. + String tableName = "test_create_table_policytags"; + TableId tableId = TableId.of(DATASET, tableName); StandardTableDefinition tableDefinition = - StandardTableDefinition.newBuilder().setSchema(POLICY_SCHEMA).build(); + StandardTableDefinition.newBuilder().setSchema(policySchema).build(); Table createdTable = bigquery.create(TableInfo.of(tableId, tableDefinition)); assertNotNull(createdTable); Table remoteTable = bigquery.getTable(DATASET, tableName); - assertEquals(POLICY_SCHEMA, remoteTable.getDefinition().getSchema()); - } finally { + assertEquals(policySchema, remoteTable.getDefinition().getSchema()); bigquery.delete(tableId); + + // Clean up policy tags + policyTagManagerClient.deletePolicyTag(policyTagId); + policyTagManagerClient.deleteTaxonomy(taxonomyId); } } diff --git a/pom.xml b/pom.xml index d5a619c90..a07e6e888 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 1.128.1 + 1.128.2 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -87,7 +87,7 @@ com.google.cloud google-cloud-bigquery - 1.128.1 + 1.128.2 @@ -118,7 +118,19 @@ com.google.cloud google-cloud-storage - 1.113.15 + 1.113.16 + test + + + com.google.cloud + google-cloud-datacatalog + 1.3.2 + test + + + com.google.api.grpc + proto-google-cloud-datacatalog-v1 + 1.3.2 test diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index ccd3309e7..fa88de147 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -45,7 +45,7 @@ com.google.cloud google-cloud-bigquery - 1.128.0 + 1.128.1 @@ -63,13 +63,13 @@ com.google.cloud google-cloud-bigtable - 1.23.1 + 1.23.2 test com.google.cloud google-cloud-bigqueryconnection - 1.0.14 + 1.0.15 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index d2920f482..0d561eb4d 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 1.128.1 + 1.128.2 @@ -61,13 +61,13 @@ com.google.cloud google-cloud-bigtable - 1.23.1 + 1.23.2 test com.google.cloud google-cloud-bigqueryconnection - 1.0.14 + 1.0.15 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 9d1b9ec21..a673300c1 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -47,7 +47,7 @@ com.google.cloud libraries-bom - 20.1.0 + 20.2.0 pom import @@ -79,13 +79,13 @@ com.google.cloud google-cloud-bigtable - 1.23.1 + 1.23.2 test com.google.cloud google-cloud-bigqueryconnection - 1.0.14 + 1.0.15 test diff --git a/synth.py b/synth.py index 8d5aa0e5b..381c973f7 100644 --- a/synth.py +++ b/synth.py @@ -26,5 +26,6 @@ '.kokoro/nightly/samples.cfg', '.kokoro/presubmit/java8-samples.cfg', '.kokoro/presubmit/java11-samples.cfg', + '.kokoro/dependencies.sh', 'codecov.yaml' ]) diff --git a/versions.txt b/versions.txt index 809ef9037..c0a859f42 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.128.1:1.128.1 \ No newline at end of file +google-cloud-bigquery:1.128.2:1.128.2 \ No newline at end of file