|
| 1 | +# Based on |
| 2 | +# https://github.com/opentdf/java-sdk/blob/v0.6.1/.github/workflows/checks.yaml |
| 3 | +name: "Platform Integration testing" |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + |
| 8 | +# on: |
| 9 | +# pull_request: |
| 10 | +# branches: |
| 11 | +# - main |
| 12 | +# push: |
| 13 | +# branches: |
| 14 | +# - main |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + |
| 21 | + platform-integration: |
| 22 | + runs-on: ubuntu-22.04 |
| 23 | + steps: |
| 24 | + - name: Checkout Java SDK |
| 25 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 26 | + - uses: bufbuild/buf-setup-action@382440cdb8ec7bc25a68d7b4711163d95f7cc3aa |
| 27 | + with: |
| 28 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + |
| 30 | + - name: Check out platform |
| 31 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 32 | + with: |
| 33 | + repository: opentdf/platform |
| 34 | + ref: main |
| 35 | + path: platform |
| 36 | + - name: Set up go |
| 37 | + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 |
| 38 | + with: |
| 39 | + go-version: "1.22.3" |
| 40 | + check-latest: false |
| 41 | + cache-dependency-path: | |
| 42 | + platform/service/go.sum |
| 43 | + platform/examples/go.sum |
| 44 | + platform/protocol/go/go.sum |
| 45 | + platform/sdk/go.sum |
| 46 | + - run: go mod download |
| 47 | + working-directory: platform |
| 48 | + - run: go mod verify |
| 49 | + working-directory: platform |
| 50 | + - name: Create keys |
| 51 | + run: | |
| 52 | + .github/scripts/init-temp-keys.sh |
| 53 | + cp opentdf-dev.yaml opentdf.yaml |
| 54 | + sudo chmod -R 777 ./keys |
| 55 | + working-directory: platform |
| 56 | + # - name: Trust the locally issued cert |
| 57 | + # run: | |
| 58 | + # keytool \ |
| 59 | + # -importcert \ |
| 60 | + # -storepass changeit \ |
| 61 | + # -noprompt \ |
| 62 | + # -file localhost.crt \ |
| 63 | + # -keystore $JAVA_HOME/lib/security/cacerts \ |
| 64 | + # -alias localhost-for-tests |
| 65 | + # working-directory: platform/keys |
| 66 | + - name: Bring the services up |
| 67 | + run: docker compose up -d --wait --wait-timeout 240 |
| 68 | + working-directory: platform |
| 69 | + - name: Provision keycloak |
| 70 | + run: go run ./service provision keycloak |
| 71 | + working-directory: platform |
| 72 | + - name: Provision fixtures |
| 73 | + run: go run ./service provision fixtures |
| 74 | + working-directory: platform |
| 75 | + - name: Start server in background |
| 76 | + uses: JarvusInnovations/background-action@2428e7b970a846423095c79d43f759abf979a635 |
| 77 | + with: |
| 78 | + run: | |
| 79 | + go run ./service start |
| 80 | + wait-on: | |
| 81 | + tcp:localhost:8080 |
| 82 | + log-output-if: true |
| 83 | + wait-for: 90s |
| 84 | + working-directory: platform |
| 85 | + - name: Get grpcurl |
| 86 | + run: go install github.com/fullstorydev/grpcurl/cmd/[email protected] |
| 87 | + - name: Make sure that the platform is up |
| 88 | + run: | |
| 89 | + grpcurl -plaintext localhost:8080 list && \ |
| 90 | + grpcurl -plaintext localhost:8080 kas.AccessService/PublicKey |
| 91 | +
|
| 92 | + # - name: Validate the SDK through the command line interface |
| 93 | + # run: | |
| 94 | + # printf 'here is some data to encrypt' > data |
| 95 | + |
| 96 | + # java -jar target/cmdline.jar \ |
| 97 | + # --client-id=opentdf-sdk \ |
| 98 | + # --client-secret=secret \ |
| 99 | + # --platform-endpoint=localhost:8080 \ |
| 100 | + # -i \ |
| 101 | + # encrypt --kas-url=localhost:8080 --mime-type=text/plain --attr https://example.com/attr/attr1/value/value1 --autoconfigure=false -f data -m 'here is some metadata' > test.tdf |
| 102 | + |
| 103 | + # java -jar target/cmdline.jar \ |
| 104 | + # --client-id=opentdf-sdk \ |
| 105 | + # --client-secret=secret \ |
| 106 | + # --platform-endpoint=localhost:8080 \ |
| 107 | + # -i \ |
| 108 | + # decrypt -f test.tdf > decrypted |
| 109 | + |
| 110 | + # java -jar target/cmdline.jar \ |
| 111 | + # --client-id=opentdf-sdk \ |
| 112 | + # --client-secret=secret \ |
| 113 | + # --platform-endpoint=localhost:8080 \ |
| 114 | + # -i \ |
| 115 | + # metadata -f test.tdf > metadata |
| 116 | + |
| 117 | + # if ! diff -q data decrypted; then |
| 118 | + # printf 'decrypted data is incorrect [%s]' "$(< decrypted)" |
| 119 | + # exit 1 |
| 120 | + # fi |
| 121 | + |
| 122 | + # if [ "$(< metadata)" != 'here is some metadata' ]; then |
| 123 | + # printf 'metadata is incorrect [%s]\n' "$(< metadata)" |
| 124 | + # exit 1 |
| 125 | + # fi |
| 126 | + # working-directory: cmdline |
| 127 | + |
| 128 | + # - name: Encrypt/Decrypt NanoTDF |
| 129 | + # run: | |
| 130 | + # echo 'here is some data to encrypt' > data |
| 131 | + |
| 132 | + # java -jar target/cmdline.jar \ |
| 133 | + # --client-id=opentdf-sdk \ |
| 134 | + # --client-secret=secret \ |
| 135 | + # --platform-endpoint=localhost:8080 \ |
| 136 | + # -i \ |
| 137 | + # encryptnano --kas-url=http://localhost:8080 --attr https://example.com/attr/attr1/value/value1 -f data -m 'here is some metadata' > nano.ntdf |
| 138 | + |
| 139 | + # java -jar target/cmdline.jar \ |
| 140 | + # --client-id=opentdf-sdk \ |
| 141 | + # --client-secret=secret \ |
| 142 | + # --platform-endpoint=localhost:8080 \ |
| 143 | + # -i \ |
| 144 | + # decryptnano -f nano.ntdf > decrypted |
| 145 | + |
| 146 | + # if ! diff -q data decrypted; then |
| 147 | + # printf 'decrypted data is incorrect [%s]' "$(< decrypted)" |
| 148 | + # exit 1 |
| 149 | + # fi |
| 150 | + # working-directory: cmdline |
| 151 | + |
| 152 | + # - uses: JarvusInnovations/background-action@2428e7b970a846423095c79d43f759abf979a635 |
| 153 | + # name: start another KAS server in background |
| 154 | + # with: |
| 155 | + # run: > |
| 156 | + # <opentdf.yaml >opentdf-beta.yaml yq e ' |
| 157 | + # (.server.port = 8282) |
| 158 | + # | (.mode = ["kas"]) |
| 159 | + # | (.sdk_config = {"endpoint":"http://localhost:8080","plaintext":true,"client_id":"opentdf","client_secret":"secret"}) |
| 160 | + # ' |
| 161 | + # && go run ./service --config-file ./opentdf-beta.yaml start |
| 162 | + # wait-on: | |
| 163 | + # tcp:localhost:8282 |
| 164 | + # log-output-if: true |
| 165 | + # wait-for: 90s |
| 166 | + # working-directory: platform |
| 167 | + # - name: Make sure that the second platform is up |
| 168 | + # run: | |
| 169 | + # grpcurl -plaintext localhost:8282 kas.AccessService/PublicKey |
| 170 | + # - name: Validate multikas through the command line interface |
| 171 | + # run: | |
| 172 | + # printf 'here is some data to encrypt' > data |
| 173 | + |
| 174 | + # java -jar target/cmdline.jar \ |
| 175 | + # --client-id=opentdf-sdk \ |
| 176 | + # --client-secret=secret \ |
| 177 | + # --platform-endpoint=localhost:8080 \ |
| 178 | + # -i \ |
| 179 | + # encrypt --kas-url=localhost:8080,localhost:8282 -f data -m 'here is some metadata' > test.tdf |
| 180 | + |
| 181 | + # java -jar target/cmdline.jar \ |
| 182 | + # --client-id=opentdf-sdk \ |
| 183 | + # --client-secret=secret \ |
| 184 | + # --platform-endpoint=localhost:8080 \ |
| 185 | + # -i \ |
| 186 | + # decrypt -f test.tdf > decrypted |
| 187 | + |
| 188 | + # java -jar target/cmdline.jar \ |
| 189 | + # --client-id=opentdf-sdk \ |
| 190 | + # --client-secret=secret \ |
| 191 | + # --platform-endpoint=localhost:8080 \ |
| 192 | + # -i \ |
| 193 | + # metadata -f test.tdf > metadata |
| 194 | + |
| 195 | + # if ! diff -q data decrypted; then |
| 196 | + # printf 'decrypted data is incorrect [%s]' "$(< decrypted)" |
| 197 | + # exit 1 |
| 198 | + # fi |
| 199 | + |
| 200 | + # if [ "$(< metadata)" != 'here is some metadata' ]; then |
| 201 | + # printf 'metadata is incorrect [%s]\n' "$(< metadata)" |
| 202 | + # exit 1 |
| 203 | + # fi |
| 204 | + # working-directory: cmdline |
| 205 | + |
| 206 | + # platform-xtest: |
| 207 | + # permissions: |
| 208 | + # contents: read |
| 209 | + # packages: read |
| 210 | + # needs: platform-integration |
| 211 | + # uses: opentdf/tests/.github/workflows/xtest.yml@main |
| 212 | + # with: |
| 213 | + # java-ref: ${{ github.ref }} |
| 214 | + |
| 215 | + # ci: |
| 216 | + # needs: |
| 217 | + # - platform-integration |
| 218 | + # - platform-xtest |
| 219 | + # - mavenverify |
| 220 | + # - pr |
| 221 | + # runs-on: ubuntu-latest |
| 222 | + # if: always() |
| 223 | + # steps: |
| 224 | + # - if: contains(needs.*.result, 'failure') |
| 225 | + # run: echo "Failed due to ${{ contains(needs.*.result, 'failure') }}" && exit 1 |
0 commit comments