Skip to content

Commit

Permalink
Merge branch 'main' into feature/update-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmihalcik-virtru authored Nov 12, 2024
2 parents 2a5a38b + 0d6e761 commit ee7bd42
Show file tree
Hide file tree
Showing 50 changed files with 1,219 additions and 40 deletions.
41 changes: 39 additions & 2 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,48 @@ jobs:
distribution: "adopt"
server-id: github
- name: Maven Verify
run: |
mvn --batch-mode verify
run: mvn --batch-mode verify
env:
BUF_INPUT_HTTPS_USERNAME: opentdf-bot
BUF_INPUT_HTTPS_PASSWORD: ${{ secrets.PERSONAL_ACCESS_TOKEN_OPENTDF }}

sonarcloud:
name: SonarCloud Scan
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0
- uses: bufbuild/buf-setup-action@2211e06e8cf26d628cda2eea15c95f8c42b080b3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@5896cecc08fd8a1fbdfaf517e29b571164b031f7
with:
java-version: "17"
distribution: "temurin"
server-id: github
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Maven Test Coverage
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUF_INPUT_HTTPS_USERNAME: opentdf-bot
BUF_INPUT_HTTPS_PASSWORD: ${{ secrets.PERSONAL_ACCESS_TOKEN_OPENTDF }}
run: mvn --batch-mode clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=opentdf_java-sdk -P coverage

platform-integration:
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -257,6 +293,7 @@ jobs:
- platform-integration
- platform-xtest
- mavenverify
- sonarcloud
- pr
runs-on: ubuntu-latest
if: always()
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "CodeQL"

on:
schedule:
- cron: '0 13 * * 1' # At 1:00 PM UTC every Monday
pull_request:
paths:
- '.github/workflows/codeql.yaml'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Buf setup
uses: bufbuild/buf-setup-action@2211e06e8cf26d628cda2eea15c95f8c42b080b3

- name: Initialize the CodeQL tools for scanning
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
timeout-minutes: 5

- name: Autobuild
uses: github/codeql-action/autobuild@v3
timeout-minutes: 10

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
timeout-minutes: 10
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.7.3"
".": "0.7.5"
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [0.7.5](https://github.com/opentdf/java-sdk/compare/v0.7.4...v0.7.5) (2024-10-29)


### Features

* Examples module ([#202](https://github.com/opentdf/java-sdk/issues/202)) ([ac13a0a](https://github.com/opentdf/java-sdk/commit/ac13a0a7c82caed920238244cf7adaca3039fdea))


### Bug Fixes

* **sdk:** option to disable assertion verification ([#205](https://github.com/opentdf/java-sdk/issues/205)) ([78d7b66](https://github.com/opentdf/java-sdk/commit/78d7b66e40bb52340e604ab645830287c91ba534))

## [0.7.4](https://github.com/opentdf/java-sdk/compare/v0.7.3...v0.7.4) (2024-10-24)


### Bug Fixes

* **sdk:** returns the correct string associated with enums ([#200](https://github.com/opentdf/java-sdk/issues/200)) ([1dffd35](https://github.com/opentdf/java-sdk/commit/1dffd35374c40ebaa095594d2a5db138957c6e38))


### Documentation

* JavaDoc ([#196](https://github.com/opentdf/java-sdk/issues/196)) ([33c9513](https://github.com/opentdf/java-sdk/commit/33c9513de68954cccba854d501ba26b62216df89))
* minor Java SDK README updates ([#193](https://github.com/opentdf/java-sdk/issues/193)) ([e9dc738](https://github.com/opentdf/java-sdk/commit/e9dc738cc40ffc97d3f0084086b1afa1c283850c))

## [0.7.3](https://github.com/opentdf/java-sdk/compare/v0.7.2...v0.7.3) (2024-10-09)


Expand Down
2 changes: 1 addition & 1 deletion cmdline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.opentdf.platform</groupId>
<artifactId>sdk-pom</artifactId>
<version>0.7.4-SNAPSHOT</version>
<version>0.7.5</version>
</parent>
<artifactId>cmdline</artifactId>
<properties>
Expand Down
21 changes: 20 additions & 1 deletion cmdline/src/main/java/io/opentdf/platform/Command.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.opentdf.platform;

import com.google.gson.JsonSyntaxException;
import com.nimbusds.jose.JOSEException;
import io.opentdf.platform.sdk.*;
import io.opentdf.platform.sdk.TDF;

import com.google.gson.Gson;
import org.apache.commons.codec.DecoderException;
import picocli.CommandLine;
import picocli.CommandLine.HelpCommand;
Expand Down Expand Up @@ -64,7 +66,9 @@ void encrypt(
@Option(names = { "-a", "--attr" }, defaultValue = Option.NULL_VALUE) Optional<String> attributes,
@Option(names = { "-c",
"--autoconfigure" }, defaultValue = Option.NULL_VALUE) Optional<Boolean> autoconfigure,
@Option(names = { "--mime-type" }, defaultValue = Option.NULL_VALUE) Optional<String> mimeType)
@Option(names = { "--mime-type" }, defaultValue = Option.NULL_VALUE) Optional<String> mimeType,
@Option(names = { "--with-assertions" }, defaultValue = Option.NULL_VALUE) Optional<String> assertion)

throws IOException, JOSEException, AutoConfigureException, InterruptedException, ExecutionException {

var sdk = buildSDK();
Expand All @@ -79,6 +83,21 @@ void encrypt(
metadata.map(Config::withMetaData).ifPresent(configs::add);
autoconfigure.map(Config::withAutoconfigure).ifPresent(configs::add);
mimeType.map(Config::withMimeType).ifPresent(configs::add);

if (assertion.isPresent()) {
var assertionConfig = assertion.get();
Gson gson = new Gson();

AssertionConfig[] assertionConfigs;
try {
assertionConfigs = gson.fromJson(assertionConfig, AssertionConfig[].class);
} catch (JsonSyntaxException e) {
throw new RuntimeException("Failed to parse assertion, expects an list of assertions", e);
}

configs.add(Config.withAssertionConfig(assertionConfigs));
}

if (attributes.isPresent()) {
configs.add(Config.withDataAttributes(attributes.get().split(",")));
}
Expand Down
14 changes: 14 additions & 0 deletions examples/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: v1
managed:
enabled: true
java_package_prefix:
default: io.opentdf.platform
except:
- buf.build/bufbuild/protovalidate
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
plugins:
- plugin: buf.build/protocolbuffers/java:v25.3
out: ./
- plugin: buf.build/grpc/java:v1.61.1
out: ./
18 changes: 18 additions & 0 deletions examples/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: bufbuild
repository: protovalidate
commit: f05a6f4403ce4327bae4f50f281c3ed0
digest: shake256:668a0661b8df44d41839194896329330965fc215f3d2f88057fd60eeb759c2daf6cc6edfdd13b2a653d49fe2896ebedcb1a33c4c5b2dd10919f03ffb7fc52ae6
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 7e6f6e774e29406da95bd61cdcdbc8bc
digest: shake256:fe43dd2265ea0c07d76bd925eeba612667cf4c948d2ce53d6e367e1b4b3cb5fa69a51e6acb1a6a50d32f894f054a35e6c0406f6808a483f2752e10c866ffbf73
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
commit: 3f42134f4c564983838425bc43c7a65f
digest: shake256:3d11d4c0fe5e05fda0131afefbce233940e27f0c31c5d4e385686aea58ccd30f72053f61af432fa83f1fc11cda57f5f18ca3da26a29064f73c5a0d076bba8d92
22 changes: 22 additions & 0 deletions examples/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: v1
deps:
- buf.build/bufbuild/protovalidate
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
breaking:
use:
- FILE
- PACKAGE
- WIRE_JSON
- WIRE
lint:
allow_comment_ignores: true
use:
- DEFAULT
except:
- PACKAGE_VERSION_SUFFIX
ignore_only:
PACKAGE_VERSION_SUFFIX:
- google/api/annotations.proto
- google/api/http.proto
- google/protobuf/wrappers.proto
Loading

0 comments on commit ee7bd42

Please sign in to comment.