Skip to content

Commit 86f676e

Browse files
authored
Merge pull request #3116 from activeloopai/ci-cd-optimize
Optimize deployment.
2 parents 8cf42c7 + ae0b58f commit 86f676e

1 file changed

Lines changed: 44 additions & 4 deletions

File tree

.github/workflows/pg-extension-build.yaml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ jobs:
259259
build_container_images:
260260
name: Build Container Images
261261
if: github.event_name == 'workflow_dispatch'
262-
needs: [setup, extension-build, repo-build]
262+
needs: [setup, extension-build]
263263
env:
264264
OP_SERVICE_ACCOUNT_TOKEN: "${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}"
265265
VERSION: "${{ needs.extension-build.outputs.version }}"
@@ -272,6 +272,49 @@ jobs:
272272
- name: checkout
273273
uses: actions/checkout@v6.0.1
274274

275+
- name: configure aws credentials
276+
uses: aws-actions/configure-aws-credentials@v5.1.1
277+
with:
278+
role-to-assume: "arn:aws:iam::067976305224:role/github"
279+
aws-region: us-east-1
280+
281+
- name: download build artifacts
282+
shell: bash
283+
run: |-
284+
for arch in x86_64 aarch64; do
285+
aws s3 cp "s3://activeloop-platform-tests/indra/artifacts/postgres/postgres-${arch}.tar" postgres-"${arch}".tar
286+
tar xf postgres-"${arch}".tar
287+
done
288+
289+
- name: build deb packages
290+
shell: bash
291+
env:
292+
PG_VERSION: "${{ matrix.version }}"
293+
VERSION: "${{ needs.extension-build.outputs.version }}"
294+
run: |-
295+
mkdir -p ./debs
296+
for arch_pair in "amd64:x86_64" "arm64:aarch64"; do
297+
ARCH="${arch_pair%%:*}"
298+
ARTIFACT_DIR="postgres-${arch_pair##*:}"
299+
DEB_PATH=$(mktemp -d)
300+
mkdir -p "${DEB_PATH}/pg-deeplake-${PG_VERSION}/DEBIAN/"
301+
mkdir -p "${DEB_PATH}/pg-deeplake-${PG_VERSION}/usr/lib/postgresql/${PG_VERSION}/lib/"
302+
mkdir -p "${DEB_PATH}/pg-deeplake-${PG_VERSION}/usr/share/postgresql/${PG_VERSION}/extension/"
303+
install -m 644 "${ARTIFACT_DIR}"/pg_deeplake_"${PG_VERSION}".so "${DEB_PATH}/pg-deeplake-${PG_VERSION}/usr/lib/postgresql/${PG_VERSION}/lib/pg_deeplake"
304+
install -m 644 "${ARTIFACT_DIR}"/pg_deeplake*.sql "${DEB_PATH}/pg-deeplake-${PG_VERSION}/usr/share/postgresql/${PG_VERSION}/extension/"
305+
install -m 644 "${ARTIFACT_DIR}"/pg_deeplake.control "${DEB_PATH}/pg-deeplake-${PG_VERSION}/usr/share/postgresql/${PG_VERSION}/extension/"
306+
printf '%s\n' \
307+
"Package: pg-deeplake-${PG_VERSION}" \
308+
"Version: ${VERSION}" \
309+
"Section: database" \
310+
"Priority: optional" \
311+
"Architecture: ${ARCH}" \
312+
"Maintainer: Activeloop SRE <sre@activeloop.dev>" \
313+
"Description: PostgreSQL ${PG_VERSION} DeepLake Extension." \
314+
> "${DEB_PATH}/pg-deeplake-${PG_VERSION}/DEBIAN/control"
315+
dpkg --build "${DEB_PATH}/pg-deeplake-${PG_VERSION}" "./debs/pg-deeplake-${PG_VERSION}_${VERSION}-1_${ARCH}.deb"
316+
done
317+
275318
- name: load 1pass
276319
id: load-1pass
277320
uses: 1password/load-secrets-action@v3.0.0
@@ -298,10 +341,7 @@ jobs:
298341
PG_VERSION: "${{ matrix.version }}"
299342
VERSION: "${{ needs.extension-build.outputs.version }}"
300343
run: |-
301-
mkdir -p ./debs
302344
echo "Using package version: ${VERSION}"
303-
wget https://packages.activeloop.io/deb/pg-deeplake/pool/main/pg-deeplake-"${PG_VERSION}"_"${VERSION}"-1_amd64.deb -O ./debs/pg-deeplake-"${PG_VERSION}"_"${VERSION}"-1_amd64.deb
304-
wget https://packages.activeloop.io/deb/pg-deeplake/pool/main/pg-deeplake-"${PG_VERSION}"_"${VERSION}"-1_arm64.deb -O ./debs/pg-deeplake-"${PG_VERSION}"_"${VERSION}"-1_arm64.deb
305345
sed s/BASE_IMAGE/postgres:"${PG_VERSION}"-bookworm/g postgres/Dockerfile > Dockerfile.build
306346
docker buildx build \
307347
--push \

0 commit comments

Comments
 (0)