Skip to content

Commit 4826a5a

Browse files
authored
Merge pull request #182 from permitio/omer/per-10768-fix-pdp-cicd-with-and-without-vanilla-datasync
Fix PDP CI with datasync factstore
2 parents 28f812a + 94083a9 commit 4826a5a

File tree

4 files changed

+41
-74
lines changed

4 files changed

+41
-74
lines changed

.github/workflows/pdp_cicd.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,22 @@ jobs:
3232
cd ./permit-opa
3333
find * -name '*go*' -print0 | xargs -0 tar -czf "$build_root"/custom/custom_opa.tar.gz --exclude '.*'
3434
35+
- uses: robinraju/release-downloader@v1
36+
with:
37+
repository: permitio/datasync
38+
latest: true
39+
fileName: factstore_server*
40+
token: ${{ secrets.CLONE_REPO_TOKEN }}
41+
out-file-path: "datasync"
42+
3543
- name: Build and load image for PDP E2E tests
3644
uses: docker/build-push-action@v5
3745
with:
3846
push: false
3947
load: true
4048
context: .
49+
build-args: |
50+
ALLOW_MISSING_FACTSTORE=false
4151
platforms: linux/amd64
4252
tags: permitio/pdp-v2:test
4353
cache-from: type=gha
@@ -164,6 +174,8 @@ jobs:
164174
push: true
165175
context: .
166176
platforms: linux/amd64,linux/arm64
177+
build-args: |
178+
ALLOW_MISSING_FACTSTORE=false
167179
tags: permitio/pdp-v2:${{ github.event.release.tag_name }}
168180
cache-from: type=gha
169181
cache-to: type=gha,mode=max
@@ -175,6 +187,8 @@ jobs:
175187
push: true
176188
context: .
177189
platforms: linux/amd64,linux/arm64
190+
build-args: |
191+
ALLOW_MISSING_FACTSTORE=false
178192
tags: permitio/pdp-v2:${{ github.event.release.tag_name }},permitio/pdp-v2:latest
179193
cache-from: type=gha
180194
cache-to: type=gha,mode=max

.github/workflows/pdp_cicd_manual.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

Dockerfile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ COPY horizon setup.py MANIFEST.in ./
1818
RUN python setup.py install --user
1919

2020
FROM golang:bullseye as BinariesBuildStage
21-
21+
ARG ALLOW_MISSING_FACTSTORE=true
2222
COPY custom* /custom
2323
COPY datasync* /datasync
2424

@@ -52,18 +52,39 @@ RUN if [ -f /datasync/datasync.tar.gz ]; \
5252
else \
5353
case $(uname -m) in \
5454
x86_64) \
55-
cp datasync/factstore_server-linux-amd64 /factstore \
55+
if [ -f /datasync/factstore_server-linux-amd64 ]; then \
56+
cp /datasync/factstore_server-linux-amd64 /factstore; \
57+
else \
58+
echo "factstore_server-linux-amd64 not found." ; \
59+
if [ "$ALLOW_MISSING_FACTSTORE" = "false" ]; then \
60+
echo "Missing Factstore is not allowed, exiting..."; exit 1; \
61+
else \
62+
echo "Missing Factstore is allowed, continuing..."; \
63+
touch /factstore ; \
64+
fi \
65+
fi \
5666
;; \
5767
aarch64) \
58-
cp datasync/factstore_server-linux-arm64 /factstore \
68+
if [ -f /datasync/factstore_server-linux-arm64 ]; then \
69+
cp /datasync/factstore_server-linux-arm64 /factstore; \
70+
else \
71+
echo "factstore_server-linux-arm64 not found." ; \
72+
if [ "$ALLOW_MISSING_FACTSTORE" = "false" ]; then \
73+
echo "Missing Factstore is not allowed, exiting..."; exit 1; \
74+
else \
75+
echo "Missing Factstore is allowed, continuing..."; \
76+
touch /factstore ; \
77+
fi \
78+
fi \
5979
;; \
6080
*) \
61-
echo "Unknown architecture." ; \
62-
exit 1 ; \
81+
echo "Unknown architecture." ; \
82+
exit 1 ; \
6383
;; \
6484
esac ; \
6585
fi
6686

87+
6788
# MAIN IMAGE ----------------------------------------
6889
# most of the time only this image should be built
6990
# ---------------------------------------------------

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ build-amd64: prepare
2121
@docker buildx build --platform linux/amd64 -t permitio/pdp-v2:$(VERSION) . --load
2222

2323
build-arm64: prepare
24-
@docker buildx build --platform linux/arm64 -t permitio/pdp-v2:$(VERSION) . --load
24+
@docker buildx build --build-arg ALLOW_MISSING_FACTSTORE=false --platform linux/arm64 -t permitio/pdp-v2:$(VERSION) . --load
2525

2626
run: run-prepare
2727
@docker run -p 7766:7000 --env PDP_API_KEY=$(API_KEY) --env PDP_DEBUG=true permitio/pdp-v2:$(VERSION)

0 commit comments

Comments
 (0)