Skip to content

Commit

Permalink
Fix deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldizsar Mezei committed May 11, 2024
1 parent e13de2d commit 1a750a4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/functions/deploy.script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { CloudFunctions } from './src/runtime/common';
import * as onScheduled from './src/runtime/cron/index';
import { ScheduledFunction } from './src/runtime/cron/scheduled';
import * as onRequests from './src/runtime/https/index';
import * as onStorage from './src/runtime/storage/index';
import * as onTriggers from './src/runtime/trigger/index';

const file = './deploy.sh';
Expand All @@ -31,11 +30,8 @@ const deployServices = () => {
...flattenObject(onRequests),
...flattenObject(onTriggers),
...flattenObject(onScheduled),
...flattenObject(onStorage),
}).forEach(([name, value], index) => {
if (index % 50 === 0) {
fs.appendFileSync(file, 'wait\n\n');
}
// ...flattenObject(onStorage),
}).forEach(([name, value]) => {
const options = (value as CloudFunctions).runtimeOptions;

let command = `gcloud run deploy ${name} \\
Expand Down Expand Up @@ -86,6 +82,7 @@ const deployServices = () => {
// };

const deployFirestoreTriggers = () => {
fs.appendFileSync(file, 'echo deployFirestoreTriggers\n\n');
Object.entries(flattenObject(onTriggers)).forEach(([name]) => {
const command = `if ! gcloud pubsub topics list --format="value(name)" | grep -q "${name}"; then
gcloud pubsub topics create "${name}"\nfi &\n\n`;
Expand All @@ -109,6 +106,7 @@ const deployFirestoreTriggers = () => {
};

const deployCronTriggers = () => {
fs.appendFileSync(file, 'echo deployCronTriggers\n\n');
Object.entries(flattenObject(onScheduled)).forEach(([name]) => {
const command = `if ! gcloud pubsub topics list --format="value(name)" | grep -q "${name}"; then
gcloud pubsub topics create "${name}"\nfi &\n\n`;
Expand Down Expand Up @@ -148,9 +146,10 @@ const deployCronTriggers = () => {
};

const setMaxAckDeadline = () => {
fs.appendFileSync(file, 'echo setMaxAckDeadline\n\n');
fs.appendFileSync(
file,
`for SUBSCRIPTION_NAME in $(gcloud pubsub subscriptions list --format="value(name)")\n`,
`for SUBSCRIPTION_NAME in $(gcloud pubsub subscriptions list --format="value(name)" | grep -v 'subs-onupsert')\n`,
);
fs.appendFileSync(file, `do\n`);
fs.appendFileSync(
Expand All @@ -162,6 +161,7 @@ const setMaxAckDeadline = () => {
};

const createUpsertTopic = () => {
fs.appendFileSync(file, 'echo createUpsertTopic\n\n');
const command = `if ! gcloud pubsub topics list --format="value(name)" | grep -q onupsert; then
gcloud pubsub topics create onupsert\nfi \n\n`;
fs.appendFileSync(file, command);
Expand Down

0 comments on commit 1a750a4

Please sign in to comment.