Skip to content

Commit e2c0e27

Browse files
authored
Merge pull request #27 from andreaTP/styra-org
After repo transfer follow up
2 parents 55364d6 + 85426ce commit e2c0e27

29 files changed

+597
-395
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
with:
2727
repository: open-policy-agent/opa
2828
ref: main
29-
# ref: v0.67.1
3029
path: opa
3130
- name: Prep OPA cases
3231
working-directory: opa
@@ -44,7 +43,7 @@ jobs:
4443
matrix:
4544
java-version: [11, 17, 21]
4645
opa-version:
47-
- 0.67.1 # latest
46+
- 0.70.0 # latest
4847

4948
steps:
5049
- uses: actions/checkout@v4
@@ -65,7 +64,7 @@ jobs:
6564
with:
6665
version: ${{ matrix.opa-version }}
6766

68-
- name: Test OPA-Chicory
67+
- name: Test opa-java-wasm
6968
run: mvn -B spotless:apply clean install
7069

7170
- name: Publish Test Report

.github/workflows/release.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-version:
7+
description: 'Version being released'
8+
required: true
9+
branch:
10+
description: 'Branch to release from'
11+
required: true
12+
default: 'main'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
release:
19+
name: Release
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Java
27+
uses: actions/setup-java@v4
28+
with:
29+
java-version: 11
30+
distribution: 'temurin'
31+
server-id: ossrh
32+
server-username: MAVEN_USERNAME
33+
server-password: MAVEN_CENTRAL_TOKEN
34+
gpg-private-key: ${{ secrets.java_gpg_secret_key }}
35+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
36+
37+
- id: install-secret-key
38+
name: Install gpg secret key
39+
run: |
40+
cat <(echo -e "${{ secrets.java_gpg_secret_key }}") | gpg --batch --import
41+
gpg --list-secret-keys --keyid-format LONG
42+
43+
- name: Compile
44+
run: mvn --batch-mode clean install -DskipTests
45+
46+
- name: Setup Git
47+
run: |
48+
git config --global user.name "GitHub Actions"
49+
git config --global user.email "actions@github.com"
50+
51+
- name: Set the version
52+
run: |
53+
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.release-version }}
54+
git add .
55+
git commit -m "Release version update ${{ github.event.inputs.release-version }}"
56+
git push
57+
git tag ${{ github.event.inputs.release-version }}
58+
git push origin ${{ github.event.inputs.release-version }}
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Release to Maven Central
63+
run: |
64+
mvn --batch-mode clean deploy -Drelease -DskipTests=true -X
65+
env:
66+
MAVEN_USERNAME: ${{ secrets.ossrh_username }}
67+
MAVEN_CENTRAL_TOKEN: ${{ secrets.ossrh_password }}
68+
MAVEN_GPG_PASSPHRASE: ${{ secrets.java_gpg_passphrase }}
69+
70+
- name: Back to Snapshot
71+
run: |
72+
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=999-SNAPSHOT
73+
git add .
74+
git commit -m "Snapshot version update"
75+
git push
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Readme.md

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![CI](https://github.com/andreaTP/opa-chicory/workflows/CI/badge.svg)](https://github.com/andreaTP/opa-chicory)
2-
[![](https://jitpack.io/v/andreaTP/opa-chicory.svg)](https://jitpack.io/#andreaTP/opa-chicory)
1+
[![CI](https://github.com/StyraInc/opa-java-wasm/workflows/CI/badge.svg)](https://github.com/StyraInc/opa-java-wasm)
2+
[![](https://jitpack.io/v/StyraInc/opa-java-wasm.svg)](https://jitpack.io/#StyraInc/opa-java-wasm)
33

44
> **This repo was recently transferred to the Styra organization and work is currently under way to get everything set up here**
55
@@ -20,24 +20,13 @@ We want fast in-process OPA policies evaluations, and avoid network bottlenecks
2020

2121
## Install the module
2222

23-
With Maven, add Jitpack to the `repositories` section:
24-
25-
```xml
26-
<repositories>
27-
<repository>
28-
<id>jitpack.io</id>
29-
<url>https://jitpack.io</url>
30-
</repository>
31-
</repositories>
32-
```
33-
34-
and add the core module dependency:
23+
With Maven add the core module dependency:
3524

3625
```xml
3726
<dependency>
38-
<groupId>com.github.andreaTP.opa-chicory</groupId>
39-
<artifactId>opa-chicory-core</artifactId>
40-
<version>main-SNAPSHOT</version>
27+
<groupId>com.styra.opa</groupId>
28+
<artifactId>opa-java-wasm</artifactId>
29+
<version>latest_release</version>
4130
</dependency>
4231
```
4332

@@ -48,13 +37,13 @@ There are only a couple of steps required to start evaluating the policy.
4837
### Import the module
4938

5039
```java
51-
import com.github.andreaTP.opa.chicory.Opa;
40+
import com.styra.opa.wasm.Opa;
5241
```
5342

5443
### Load the policy
5544

5645
```java
57-
var policy = Opa.loadPolicy(policyWasm);
46+
var policy = OpaPolicy.builder().withPolicy(policyWasm).build();
5847
```
5948

6049
The `policyWasm` ca be a variety of things, including raw byte array, `InputStream`, `Path`, `File`.
@@ -63,7 +52,7 @@ The content should be the compiled policy Wasm file, a valid WebAssembly module.
6352
For example:
6453

6554
```java
66-
var policy = Opa.loadPolicy(new File("policy.wasm"));
55+
var policy = OpaPolicy.builder().withPolicy(new File("policy.wasm")).build();
6756
```
6857

6958
### Evaluate the Policy
@@ -85,7 +74,7 @@ Example:
8574
```java
8675
input = '{"path": "/", "role": "admin"}';
8776

88-
var policy = Opa.loadPolicy(policyWasm);
77+
var policy = OpaPolicy.builder().withPolicy(policyWasm).build();
8978
var result = policy.evaluate(input);
9079
System.out.println("Result is: " + result);
9180
```

core/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<parent>
5-
<groupId>com.github.andreaTP.opa.chicory</groupId>
6-
<artifactId>opa-chicory-parent</artifactId>
5+
<groupId>com.styra.opa</groupId>
6+
<artifactId>opa-java-wasm-parent</artifactId>
77
<version>999-SNAPSHOT</version>
88
</parent>
9-
<artifactId>opa-chicory-core</artifactId>
10-
<name>Opa Wasm Chicory</name>
9+
<artifactId>opa-java-wasm</artifactId>
10+
<name>Java Opa Wasm</name>
1111
<dependencies>
1212
<dependency>
1313
<groupId>com.dylibso.chicory</groupId>

0 commit comments

Comments
 (0)