Skip to content

Commit 4517949

Browse files
authored
Merge pull request #72 from UTDNebula/standardize-runners
Standardize daily/weekly/... runners
2 parents e7f3c73 + c1e5df7 commit 4517949

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
name: Deploy
44

55
on:
6+
workflow_dispatch:
67
push:
78
branches: develop
89

@@ -38,18 +39,18 @@ jobs:
3839
uses: docker/build-push-action@v6
3940
with:
4041
push: true
41-
tags: us-central1-docker.pkg.dev/api-tools-451421/runners/daily-update-events
42+
tags: us-central1-docker.pkg.dev/api-tools-451421/runners/runner
4243

43-
- name: Upload to dev job
44+
- name: Upload to daily dev job
4445
uses: google-github-actions/deploy-cloudrun@v2
4546
with:
46-
job: 'daily-update-events-dev'
47-
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/daily-update-events'
47+
job: 'daily-dev'
48+
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/runner'
4849
region: us-central1
4950

50-
- name: Upload to prod job
51+
- name: Upload to daily prod job
5152
uses: google-github-actions/deploy-cloudrun@v2
5253
with:
53-
job: 'daily-update-events-prod'
54-
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/daily-update-events'
54+
job: 'daily-prod'
55+
image: 'us-central1-docker.pkg.dev/api-tools-451421/runners/runner'
5556
region: us-central1

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ENV GOOGLE_CHROME_BIN /usr/bin/chromium # Also set this for compatibility
2525

2626
# Copy build file from builder
2727
COPY --from=builder /app/api-tools /app/api-tools
28-
COPY deploy.sh /app/deploy.sh
28+
COPY runners /app/runners
2929

30-
RUN chmod +x /app/deploy.sh
31-
ENTRYPOINT ["/app/deploy.sh"]
30+
RUN chmod +x /app/runners/setup.sh
31+
ENTRYPOINT ["/app/runners/setup.sh"]

runners/daily.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# for daily tasks to run
4+
5+
# scrape, parse, and upload events
6+
./api-tools -scrape -mazevo -verbose
7+
./api-tools -parse -mazevo -verbose
8+
./api-tools -scrape -astra -verbose
9+
./api-tools -parse -astra -verbose
10+
./api-tools -upload -events -verbose
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
#!/bin/sh
22

3-
# service account
3+
# auth with service account
44
gcloud secrets versions access latest --secret="$SERVICE_ACCOUNT_SECRET_NAME" > service_account.json
55
gcloud auth activate-service-account --key-file=service_account.json
66
rm service_account.json
77

8-
# .env
8+
# use service account to access environment variables from GCP secrets, create .env
99
gcloud secrets versions access latest --secret="$ENV_SECRET_NAME" > .env
1010

11-
# Scrape, parse, and upload
12-
./api-tools -scrape -mazevo -verbose
13-
./api-tools -parse -mazevo -verbose
14-
./api-tools -scrape -astra -verbose
15-
./api-tools -parse -astra -verbose
16-
./api-tools -upload -events -verbose
11+
# run commands from the file path specified in the GCP run job's variable
12+
sh "/app/runners/$RUNNER_SCRIPT_NAME"

0 commit comments

Comments
 (0)