Skip to content

Commit 69746c5

Browse files
committed
initial commit
0 parents  commit 69746c5

37 files changed

Lines changed: 5274 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
# ─── Versions (single source of truth) ────────────────────────────────────
11+
EJBCA_VERSION: "9.3.7"
12+
OPENSSL_VERSION: "3.6.0"
13+
JAVA_VERSION: "17"
14+
JAVA_DISTRIBUTION: "temurin"
15+
16+
# ─── Docker ───────────────────────────────────────────────────────────────
17+
REGISTRY: ghcr.io
18+
IMAGE: ghcr.io/thpham/ejbca-ce
19+
PLATFORMS: linux/amd64,linux/arm64
20+
21+
# ─── Build artifacts ──────────────────────────────────────────────────────
22+
ARTIFACT: kimbo11ng-1.0.0-SNAPSHOT-jar-with-dependencies.jar
23+
ARTIFACT_NAME: kimbo11ng-jar
24+
25+
jobs:
26+
# ─── Build fat JAR ──────────────────────────────────────────────────────────
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+
32+
- name: Set up JDK
33+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
34+
with:
35+
java-version: ${{ env.JAVA_VERSION }}
36+
distribution: ${{ env.JAVA_DISTRIBUTION }}
37+
cache: maven
38+
39+
- name: Install just
40+
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
41+
42+
- name: Cache EJBCA JARs
43+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
44+
with:
45+
path: deps/ejbca
46+
key: ejbca-jars-${{ env.EJBCA_VERSION }}
47+
48+
- name: Setup (extract JARs + install deps + build)
49+
run: just setup
50+
51+
- name: Upload JAR artifact
52+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
53+
with:
54+
name: ${{ env.ARTIFACT_NAME }}
55+
path: target/${{ env.ARTIFACT }}
56+
retention-days: 1
57+
58+
# ─── Build Docker image + integration tests (main only) ─────────────────────
59+
# Builds amd64 image into local daemon, runs the full test suite against it.
60+
# Image is NOT pushed — that only happens in the push job after tests pass.
61+
test:
62+
needs: build
63+
runs-on: ubuntu-latest
64+
if: github.ref == 'refs/heads/main'
65+
permissions:
66+
contents: read
67+
packages: read
68+
69+
steps:
70+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
71+
72+
- name: Download JAR artifact
73+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
74+
with:
75+
name: ${{ env.ARTIFACT_NAME }}
76+
path: target/
77+
78+
- name: Set up Docker Buildx
79+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
80+
81+
- name: Build Docker image (amd64, load into daemon)
82+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
83+
with:
84+
context: .
85+
file: docker/Dockerfile
86+
load: true
87+
tags: ${{ env.IMAGE }}:latest
88+
build-args: |
89+
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }}
90+
cache-from: type=gha
91+
cache-to: type=gha,mode=max
92+
93+
- name: Set up JDK
94+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
95+
with:
96+
java-version: ${{ env.JAVA_VERSION }}
97+
distribution: ${{ env.JAVA_DISTRIBUTION }}
98+
cache: maven
99+
100+
- name: Cache EJBCA JARs
101+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
102+
with:
103+
path: deps/ejbca
104+
key: ejbca-jars-${{ env.EJBCA_VERSION }}
105+
106+
- name: Install just
107+
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
108+
109+
- name: Install EJBCA JARs into local Maven repo
110+
run: just install-deps
111+
112+
- name: Run integration tests (Testcontainers + mTLS)
113+
run: mvn verify -Pit
114+
115+
- name: Upload Failsafe reports on failure
116+
if: failure()
117+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
118+
with:
119+
name: failsafe-reports
120+
path: target/failsafe-reports/
121+
122+
# ─── Push multi-arch image (only after tests pass) ──────────────────────────
123+
push:
124+
needs: test
125+
runs-on: ubuntu-latest
126+
if: github.ref == 'refs/heads/main'
127+
permissions:
128+
contents: read
129+
packages: write
130+
131+
steps:
132+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
133+
134+
- name: Download JAR artifact
135+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
136+
with:
137+
name: ${{ env.ARTIFACT_NAME }}
138+
path: target/
139+
140+
- name: Set up QEMU (multi-arch)
141+
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
142+
143+
- name: Set up Docker Buildx
144+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
145+
146+
- name: Log in to GHCR
147+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
148+
with:
149+
registry: ${{ env.REGISTRY }}
150+
username: ${{ github.actor }}
151+
password: ${{ secrets.GITHUB_TOKEN }}
152+
153+
- name: Extract metadata
154+
id: meta
155+
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
156+
with:
157+
images: ${{ env.IMAGE }}
158+
tags: |
159+
type=raw,value=latest
160+
type=raw,value=${{ env.EJBCA_VERSION }}
161+
type=sha,prefix=sha-
162+
163+
- name: Build and push (multi-arch)
164+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
165+
with:
166+
context: .
167+
file: docker/Dockerfile
168+
push: true
169+
platforms: ${{ env.PLATFORMS }}
170+
tags: ${{ steps.meta.outputs.tags }}
171+
labels: ${{ steps.meta.outputs.labels }}
172+
build-args: |
173+
OPENSSL_VERSION=${{ env.OPENSSL_VERSION }}
174+
cache-from: type=gha
175+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.omc/
2+
target/
3+
**/target/
4+
5+
# EJBCA dependency JARs (extracted from base image via `just extract-jars`)
6+
deps/
7+
deps/**
8+
9+
# reference sources (local only)
10+
.ref/
11+
.ref/**
12+
13+
# Build artifacts
14+
*.class
15+
*.jar

LICENSE

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+
1. Definitions.
8+
9+
"License" shall mean the terms and conditions for use, reproduction,
10+
and distribution as defined by Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity authorized by
13+
the copyright owner that is granting the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all
16+
other entities that control, are controlled by, or are under common
17+
control with that entity. For the purposes of this definition,
18+
"control" means (i) the power, direct or indirect, to cause the
19+
direction or management of such entity, whether by contract or
20+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
21+
outstanding shares, or (iii) beneficial ownership of such entity.
22+
23+
"You" (or "Your") shall mean an individual or Legal Entity
24+
exercising permissions granted by this License.
25+
26+
"Source" form shall mean the preferred form for making modifications,
27+
including but not limited to software source code, documentation
28+
source, and configuration files.
29+
30+
"Object" form shall mean any form resulting from mechanical
31+
transformation or translation of a Source form, including but
32+
not limited to compiled object code, generated documentation,
33+
and conversions to other media types.
34+
35+
"Work" shall mean the work of authorship made available under
36+
the License, as indicated by a copyright notice that is included in
37+
or attached to the work (an example is provided in the Appendix below).
38+
39+
"Derivative Works" shall mean any work, whether in Source or Object
40+
form, that is based on (or derived from) the Work and for which the
41+
editorial revisions, annotations, elaborations, or other modifications
42+
represent, as a whole, an original work of authorship. For the purposes
43+
of this License, Derivative Works shall not include works that remain
44+
separable from, or merely link (or bind by name) to the interfaces of,
45+
the Work and derivative works thereof.
46+
47+
"Contribution" shall mean, as defined in this License, any work of
48+
authorship, including the original version of the Work and any
49+
modifications or additions to that Work or Derivative Works of the
50+
Work, that is intentionally submitted to the Licensor for inclusion
51+
in the Work by the copyright owner or by an individual or Legal
52+
Entity authorized to submit on behalf of the copyright owner. For
53+
the purposes of this definition, "submitted" means any form of
54+
electronic, verbal, or written communication sent to the Licensor or
55+
its representatives, including but not limited to communication on
56+
electronic mailing lists, source code control systems, and issue
57+
tracking systems that are managed by, or on behalf of, the Licensor
58+
for the purpose of discussing and improving the Work, but excluding
59+
communication that is conspicuously marked or designated in writing
60+
by the copyright owner as "Not a Contribution."
61+
62+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
63+
whom a Contribution has been received by the Licensor and subsequently
64+
incorporated within the Work.
65+
66+
2. Grant of Copyright License. Subject to the terms and conditions of
67+
this License, each Contributor hereby grants to You a perpetual,
68+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69+
copyright license to reproduce, prepare Derivative Works of,
70+
publicly display, publicly perform, sublicense, and distribute the
71+
Work and such Derivative Works in Source or Object form.
72+
73+
3. Grant of Patent License. Subject to the terms and conditions of
74+
this License, each Contributor hereby grants to You a perpetual,
75+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76+
(except as stated in this section) patent license to make, have made,
77+
use, offer to sell, sell, import, and otherwise transfer the Work,
78+
where such license applies only to those patent claims licensable
79+
by such Contributor that are necessarily infringed by their
80+
Contribution(s) alone or by the combination of their Contribution(s)
81+
with the Work to which such Contribution(s) was submitted. If You
82+
institute patent litigation against any entity (including a cross-claim
83+
or counterclaim in a lawsuit) alleging that the Work or any
84+
Contribution embodied within the Work constitutes patent or
85+
contributory patent infringement, then any patent licenses granted
86+
to You under this License for that Work shall terminate as of the
87+
date such litigation is filed.
88+
89+
4. Redistribution. You may reproduce and distribute copies of the
90+
Work or Derivative Works thereof in any medium, with or without
91+
modifications, and in Source or Object form, provided that You
92+
meet the following conditions:
93+
94+
(a) You must give any other recipients of the Work or Derivative
95+
Works a copy of this License; and
96+
97+
(b) You must cause any modified files to carry prominent notices
98+
stating that You changed the files; and
99+
100+
(c) You must retain, in the Source form of any Derivative Works
101+
that You distribute, all copyright, patent, trademark, and
102+
attribution notices from the Source form of the Work,
103+
excluding those notices that do not pertain to any part of
104+
the Derivative Works; and
105+
106+
(d) If the Work includes a "NOTICE" text file as part of its
107+
distribution, You must include a readable copy of the
108+
attribution notices contained within such NOTICE file, in
109+
at least one of the following places: within a NOTICE text
110+
file distributed as part of the Derivative Works; within
111+
the Source form or documentation, if provided along with the
112+
Derivative Works; or, within a display generated by the
113+
Derivative Works, if and wherever such third-party notices
114+
normally appear. The contents of the NOTICE file are for
115+
informational purposes only and do not modify the License.
116+
You may add Your own attribution notices within Derivative
117+
Works that You distribute, alongside or in addition to the
118+
NOTICE text from the Work, provided that such additional
119+
attribution notices cannot be construed as modifying the
120+
License.
121+
122+
You may add Your own license statement for Your modifications and
123+
may provide additional grant of rights to use, copy, modify, merge,
124+
publish, distribute, sublicense, and/or sell copies of the
125+
Contribution, either on an original basis or as modified by You.
126+
127+
5. Submission of Contributions. Unless You explicitly state otherwise,
128+
any Contribution intentionally submitted for inclusion in the Work
129+
by You to the Licensor shall be under the terms and conditions of
130+
this License, without any additional terms or conditions.
131+
Notwithstanding the above, nothing herein shall supersede or modify
132+
the terms of any separate license agreement you may have executed
133+
with Licensor regarding such Contributions.
134+
135+
6. Trademarks. This License does not grant permission to use the trade
136+
names, trademarks, service marks, or product names of the Licensor,
137+
except as required for reasonable and customary use in describing the
138+
origin of the Work and reproducing the content of the NOTICE file.
139+
140+
7. Disclaimer of Warranty. Unless required by applicable law or
141+
agreed to in writing, Licensor provides the Work (and each
142+
Contributor provides its Contributions) on an "AS IS" BASIS,
143+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
144+
implied, including, without limitation, any warranties or conditions
145+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
146+
PARTICULAR PURPOSE. You are solely responsible for determining the
147+
appropriateness of using or reproducing the Work and assume any
148+
risks associated with Your exercise of permissions under this License.
149+
150+
8. Limitation of Liability. In no event and under no legal theory,
151+
whether in tort (including negligence), contract, or otherwise,
152+
unless required by applicable law (such as deliberate and grossly
153+
negligent acts) or agreed to in writing, shall any Contributor be
154+
liable to You for damages, including any direct, indirect, special,
155+
incidental, or exemplary damages of any character arising as a
156+
result of this License or out of the use or inability to use the
157+
Work (including but not limited to damages for loss of goodwill,
158+
work stoppage, computer failure or malfunction, or all other
159+
commercial damages or losses), even if such Contributor has been
160+
advised of the possibility of such damages.
161+
162+
9. Accepting Warranty or Additional Liability. While redistributing
163+
the Work or Derivative Works thereof, You may choose to offer,
164+
and charge a fee for, acceptance of support, warranty, indemnity,
165+
or other liability obligations and/or rights consistent with this
166+
License. However, in accepting such obligations, You may act only
167+
on Your own behalf and on Your sole responsibility, not on behalf
168+
of any other Contributor, and only if You agree to indemnify,
169+
defend, and hold each Contributor harmless for any liability
170+
incurred by, or claims asserted against, such Contributor by reason
171+
of your accepting any such warranty or additional liability.
172+
173+
END OF TERMS AND CONDITIONS
174+
175+
Copyright 2026 Thomas Pham
176+
177+
Licensed under the Apache License, Version 2.0 (the "License");
178+
you may not use this file except in compliance with the License.
179+
You may obtain a copy of the License at
180+
181+
http://www.apache.org/licenses/LICENSE-2.0
182+
183+
Unless required by applicable law or agreed to in writing, software
184+
distributed under the License is distributed on an "AS IS" BASIS,
185+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
186+
See the License for the specific language governing permissions and
187+
limitations under the License.

0 commit comments

Comments
 (0)