Skip to content

Commit 0b3fcde

Browse files
authored
Use TSP composite action in CI (#155)
1 parent 8ae7697 commit 0b3fcde

File tree

1 file changed

+10
-93
lines changed

1 file changed

+10
-93
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
jobs:
1111
build_and_test:
1212
runs-on: ubuntu-22.04
13-
needs: get_refs
1413
steps:
1514
- uses: actions/checkout@v6
1615
- name: set up jdk 17
@@ -29,13 +28,6 @@ jobs:
2928
run: test-suites/unitTest.sh
3029
- name: local install
3130
run: mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true -B -V
32-
- name: clone the tsp
33-
uses: actions/checkout@v6
34-
with:
35-
repository: IronCoreLabs/tenant-security-proxy
36-
ref: ${{ needs.get_refs.outputs.tenant-security-proxy }}
37-
path: tenant-security-proxy
38-
token: ${{ secrets.WORKFLOW_PAT }}
3931
- name: cache cargo registry
4032
uses: actions/cache@v4
4133
with:
@@ -44,93 +36,18 @@ jobs:
4436
~/.cargo/registry
4537
~/.cargo/git
4638
target
47-
- name: Decrypt TSP integration keys
48-
uses: IronCoreLabs/ironhide-actions/decrypt@v3
49-
with:
50-
keys: ${{ secrets.IRONHIDE_KEYS }}
51-
input: tenant-security-proxy/.env.integration.iron
52-
- name: install zmq
53-
run: sudo apt update && sudo apt install -y --no-install-recommends libzmq3-dev
54-
- name: integration test
55-
run: |
56-
cd tenant-security-proxy
57-
cargo build --release
58-
env $(cat .env.integration) cargo run --release &
59-
timeout 700 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000/ready)" =~ ''[01346-9][0-9][0-9]'' ]]; do sleep 5; done' || false
60-
env $(cat .env.integration) ../test-suites/integrationTest.sh
61-
62-
# Look for a comment telling us what refs to use from the other repos we depend on.
63-
# To add additional repositories, add them to "outputs" and to the "Setup list of required repos" step.
64-
get_refs:
65-
# Only run if it's on a PR.
66-
if: github.base_ref != ''
67-
runs-on: ubuntu-22.04
68-
outputs:
69-
tenant-security-proxy: ${{ steps.get_refs.outputs.tenant-security-proxy }}
70-
steps:
71-
- name: Setup list of required repos
39+
- name: Save TSP env.integration to a file
7240
run: |
73-
echo tenant-security-proxy >> repos
74-
- name: Get PR number
75-
id: get_pr
76-
run: |
77-
PR=$(jq -r .pull_request.number "${GITHUB_EVENT_PATH}")
78-
echo "PR is ${PR}"
79-
# Sanity check that ${PR} is a number.
80-
test "${PR}" -ge 0
81-
echo "pr=${PR}" >> "$GITHUB_OUTPUT"
82-
- name: Find Comment
83-
uses: peter-evans/find-comment@v4
84-
id: find_comment
41+
cat > .env.integration <<EOF
42+
${{ secrets.TSP_ENV_INTEGRATION }}
43+
EOF
44+
- name: Start the TSP
45+
uses: IronCoreLabs/workflows/.github/actions/start-tsp@start-tsp-v1
8546
with:
86-
issue-number: ${{ steps.get_pr.outputs.pr }}
87-
body-includes: CI_branches
88-
- name: Parse refs
89-
if: steps.find_comment.outputs.comment-id != 0
90-
id: get_refs
91-
env:
92-
COMMENT_BODY: ${{ steps.find_comment.outputs.comment-body }}
93-
run: |
94-
# Extract the JSON part of the comment into a file.
95-
echo "${COMMENT_BODY}" | tr '\n' ' ' | sed -e 's,^[^{]*,,' -e 's,[^}]*$,,' > refs.json
96-
echo "Got JSON:"
97-
cat refs.json && echo ""
98-
99-
# Sanity check that all repos in the JSON comment are ones that we know about.
100-
jq -r 'keys[]' < refs.json > extra_repos
101-
for REPO in $(cat repos) ; do
102-
grep -v "^${REPO}\$" < extra_repos > temp || true
103-
mv temp extra_repos
104-
done
105-
if [ -s extra_repos ] ; then
106-
echo "Unrecognized repositories:"
107-
cat extra_repos
108-
exit 1
109-
fi
110-
111-
# Emit an output variable for each repo.
112-
for REPO in $(cat repos) ; do
113-
REF=$(jq -r '.["'"${REPO}"'"]' < refs.json)
114-
if [ "${REF}" = "null" ] ; then
115-
REF="main"
116-
fi
117-
echo "${REPO}: ${REF}"
118-
echo "${REPO}=${REF}" >> "$GITHUB_OUTPUT"
119-
done
120-
- name: Post a reaction (parsed your comment)
121-
if: steps.get_refs.outcome == 'success'
122-
uses: peter-evans/create-or-update-comment@v5
123-
with:
124-
issue-number: ${{ steps.get_pr.outputs.pr }}
125-
comment-id: ${{ steps.find_comment.outputs.comment-id }}
126-
reactions: eyes
127-
- name: Post a reaction (unparsed comment)
128-
if: steps.get_refs.outcome == 'failure'
129-
uses: peter-evans/create-or-update-comment@v5
130-
with:
131-
issue-number: ${{ steps.get_pr.outputs.pr }}
132-
comment-id: ${{ steps.find_comment.outputs.comment-id }}
133-
reactions: confused
47+
gcloud-auth: ${{ secrets.GCLOUD_AUTH }}
48+
env-file-path: .env.integration
49+
- name: integration test
50+
run: env $(cat .env.integration) ./test-suites/integrationTest.sh
13451

13552
build_examples:
13653
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)