Skip to content

Commit 9affeee

Browse files
authored
chore: add gha for workflow worker (#194)
1 parent 20ee522 commit 9affeee

3 files changed

Lines changed: 105 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: (Develop) Build and Push Workflow Worker to AWS and GCP
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
PROJECT_ID: aesy-330511
8+
GCP_REGION: asia-south1
9+
GAR_LOCATION: asia-south1-docker.pkg.dev/aesy-330511/root-hub
10+
IMAGE_NAME: wavefront-workflow-worker
11+
12+
jobs:
13+
build-push-artifact:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: "Checkout"
18+
uses: "actions/checkout@v3"
19+
20+
- name: Get commit hash
21+
id: get-commit-hash
22+
run: echo "::set-output name=commit-hash::$(git rev-parse --short HEAD)"
23+
24+
- name: Get timestamp
25+
id: get-timestamp
26+
run: echo "::set-output name=timestamp::$(date +'%Y-%m-%d-%H-%M')"
27+
28+
- name: Cache Docker layers
29+
id: cache-docker-layers
30+
uses: actions/cache@v3
31+
with:
32+
path: /tmp/.buildx-cache
33+
key: ${{ runner.os }}-docker-${{ github.sha }}
34+
restore-keys: |
35+
${{ runner.os }}-docker-
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Build Docker Image
41+
id: build-image
42+
run: |
43+
docker build -f wavefront/server/docker/workflow.Dockerfile -t rootflo:${{ steps.get-commit-hash.outputs.commit-hash }}-${{ steps.get-timestamp.outputs.timestamp }} .
44+
echo "IMAGE_TAG=${{ steps.get-commit-hash.outputs.commit-hash }}-${{ steps.get-timestamp.outputs.timestamp }}" >> $GITHUB_ENV
45+
46+
- id: "Auth-to-GCP"
47+
uses: "google-github-actions/auth@v1"
48+
with:
49+
credentials_json: "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}"
50+
51+
- name: "Set up Cloud SDK"
52+
uses: "google-github-actions/setup-gcloud@v1"
53+
54+
- name: "Docker auth for GCP"
55+
run: |-
56+
gcloud auth configure-docker ${{ env.GCP_REGION }}-docker.pkg.dev --quiet
57+
58+
- name: Tag and push image to GCP Artifact Registry
59+
run: |
60+
docker tag rootflo:${{ env.IMAGE_TAG }} ${{ env.GAR_LOCATION }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
61+
docker push ${{ env.GAR_LOCATION }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
62+
63+
- name: Cleanup Docker images
64+
run: |
65+
docker rmi rootflo:${{ env.IMAGE_TAG }} || true
66+
docker rmi ${{ env.GAR_LOCATION }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} || true

wavefront/server/background_jobs/workflow_job/workflow_job/config.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ pubsub_subscription_id = ${GCP_PUBSUB_SUBSCRIPTION_ID}
1515
pubsub_topic_id = ${GCP_PUBSUB_TOPIC_ID}
1616
bucket = ${APPLICATION_BUCKET}
1717

18+
[gcp]
19+
gcp_asset_storage_bucket = ${APPLICATION_BUCKET}
20+
1821
[floware]
1922
service_url = ${FLOWARE_SERVICE_URL}
2023

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
COPY --from=ghcr.io/astral-sh/uv:0.8.6 /uv /uvx /bin/
6+
7+
RUN apt-get update && apt-get install -y \
8+
git \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
COPY wavefront/server/pyproject.toml wavefront/server/uv.lock ./
12+
13+
COPY wavefront/server/background_jobs/workflow_job /app/background_jobs/workflow_job
14+
COPY wavefront/server/packages/flo_cloud /app/packages/flo_cloud
15+
COPY wavefront/server/packages/flo_utils /app/packages/flo_utils
16+
17+
COPY wavefront/server/modules/api_services_module /app/modules/api_services_module
18+
COPY wavefront/server/modules/auth_module /app/modules/auth_module
19+
COPY wavefront/server/modules/agents_module /app/modules/agents_module
20+
COPY wavefront/server/modules/common_module /app/modules/common_module
21+
COPY wavefront/server/modules/db_repo_module /app/modules/db_repo_module
22+
COPY wavefront/server/modules/knowledge_base_module /app/modules/knowledge_base_module
23+
COPY wavefront/server/modules/plugins_module /app/modules/plugins_module
24+
COPY wavefront/server/modules/tools_module /app/modules/tools_module
25+
COPY wavefront/server/modules/user_management_module /app/modules/user_management_module
26+
27+
COPY wavefront/server/plugins/datasource /app/plugins/datasource
28+
COPY wavefront/server/plugins/authenticator /app/plugins/authenticator
29+
30+
# Install dependencies (without dependecy resolution and no dev dependencies)
31+
RUN uv sync --package workflow_job --frozen --no-dev
32+
33+
# change WORKDIR
34+
WORKDIR /app/background_jobs/workflow_job/workflow_job
35+
36+
CMD ["uv", "run", "main.py"]

0 commit comments

Comments
 (0)