Skip to content

Commit

Permalink
Merge pull request #182 from permitio/omer/per-10768-fix-pdp-cicd-wit…
Browse files Browse the repository at this point in the history
…h-and-without-vanilla-datasync

Fix PDP CI with datasync factstore
  • Loading branch information
omer9564 authored Sep 22, 2024
2 parents 28f812a + 94083a9 commit 4826a5a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 74 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pdp_cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ jobs:
cd ./permit-opa
find * -name '*go*' -print0 | xargs -0 tar -czf "$build_root"/custom/custom_opa.tar.gz --exclude '.*'
- uses: robinraju/release-downloader@v1
with:
repository: permitio/datasync
latest: true
fileName: factstore_server*
token: ${{ secrets.CLONE_REPO_TOKEN }}
out-file-path: "datasync"

- name: Build and load image for PDP E2E tests
uses: docker/build-push-action@v5
with:
push: false
load: true
context: .
build-args: |
ALLOW_MISSING_FACTSTORE=false
platforms: linux/amd64
tags: permitio/pdp-v2:test
cache-from: type=gha
Expand Down Expand Up @@ -164,6 +174,8 @@ jobs:
push: true
context: .
platforms: linux/amd64,linux/arm64
build-args: |
ALLOW_MISSING_FACTSTORE=false
tags: permitio/pdp-v2:${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
Expand All @@ -175,6 +187,8 @@ jobs:
push: true
context: .
platforms: linux/amd64,linux/arm64
build-args: |
ALLOW_MISSING_FACTSTORE=false
tags: permitio/pdp-v2:${{ github.event.release.tag_name }},permitio/pdp-v2:latest
cache-from: type=gha
cache-to: type=gha,mode=max
68 changes: 0 additions & 68 deletions .github/workflows/pdp_cicd_manual.yml

This file was deleted.

31 changes: 26 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY horizon setup.py MANIFEST.in ./
RUN python setup.py install --user

FROM golang:bullseye as BinariesBuildStage

ARG ALLOW_MISSING_FACTSTORE=true
COPY custom* /custom
COPY datasync* /datasync

Expand Down Expand Up @@ -52,18 +52,39 @@ RUN if [ -f /datasync/datasync.tar.gz ]; \
else \
case $(uname -m) in \
x86_64) \
cp datasync/factstore_server-linux-amd64 /factstore \
if [ -f /datasync/factstore_server-linux-amd64 ]; then \
cp /datasync/factstore_server-linux-amd64 /factstore; \
else \
echo "factstore_server-linux-amd64 not found." ; \
if [ "$ALLOW_MISSING_FACTSTORE" = "false" ]; then \
echo "Missing Factstore is not allowed, exiting..."; exit 1; \
else \
echo "Missing Factstore is allowed, continuing..."; \
touch /factstore ; \
fi \
fi \
;; \
aarch64) \
cp datasync/factstore_server-linux-arm64 /factstore \
if [ -f /datasync/factstore_server-linux-arm64 ]; then \
cp /datasync/factstore_server-linux-arm64 /factstore; \
else \
echo "factstore_server-linux-arm64 not found." ; \
if [ "$ALLOW_MISSING_FACTSTORE" = "false" ]; then \
echo "Missing Factstore is not allowed, exiting..."; exit 1; \
else \
echo "Missing Factstore is allowed, continuing..."; \
touch /factstore ; \
fi \
fi \
;; \
*) \
echo "Unknown architecture." ; \
exit 1 ; \
echo "Unknown architecture." ; \
exit 1 ; \
;; \
esac ; \
fi


# MAIN IMAGE ----------------------------------------
# most of the time only this image should be built
# ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ build-amd64: prepare
@docker buildx build --platform linux/amd64 -t permitio/pdp-v2:$(VERSION) . --load

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

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

0 comments on commit 4826a5a

Please sign in to comment.