@vaharoni/devops 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cloudrun.js +1 -1
- package/package.json +1 -1
- package/src/cli/cloudrun.ts +1 -1
- package/src/target-templates/infra-variants/digitalocean/.github/workflows/k8s-build.yaml +21 -3
- package/src/target-templates/infra-variants/gcloud/.github/workflows/k8s-build.yaml +21 -3
- package/src/target-templates/infra-variants/hetzner/.github/workflows/k8s-build.yaml +22 -4
- package/src/target-templates/lang-variants-common/typescript/.github/actions/deploy-image-cloudrun@v1/action.yaml +71 -0
- /package/src/target-templates/lang-variants-common/typescript/.github/actions/{deploy-image@v1 → deploy-image-k8s@v1}/action.yaml +0 -0
package/dist/cli/cloudrun.js
CHANGED
@@ -2,7 +2,7 @@ import { CLICommandParser, printUsageAndExit, StrongParams } from "./common";
|
|
2
2
|
import { buildDev, deploy } from "../libs/cloudrun-helpers";
|
3
3
|
const oneLiner = "Supports cloudrun images";
|
4
4
|
const keyExamples = `
|
5
|
-
$ devops cloudrun deploy cloudrun-image SHA --env staging --region us-
|
5
|
+
$ devops cloudrun deploy cloudrun-image SHA --env staging --region us-east1 [--forward-env ENV1,ENV2 --allow-unauthenticated]
|
6
6
|
$ devops cloudrun build-dev cloudrun-image
|
7
7
|
`.trim();
|
8
8
|
const usage = `
|
package/package.json
CHANGED
package/src/cli/cloudrun.ts
CHANGED
@@ -4,7 +4,7 @@ import { buildDev, deploy } from "../libs/cloudrun-helpers";
|
|
4
4
|
const oneLiner =
|
5
5
|
"Supports cloudrun images";
|
6
6
|
const keyExamples = `
|
7
|
-
$ devops cloudrun deploy cloudrun-image SHA --env staging --region us-
|
7
|
+
$ devops cloudrun deploy cloudrun-image SHA --env staging --region us-east1 [--forward-env ENV1,ENV2 --allow-unauthenticated]
|
8
8
|
$ devops cloudrun build-dev cloudrun-image
|
9
9
|
`.trim();
|
10
10
|
|
@@ -9,6 +9,8 @@ on:
|
|
9
9
|
permissions:
|
10
10
|
contents: read
|
11
11
|
packages: read
|
12
|
+
# For deploying images to Cloud Run
|
13
|
+
# id-token: write
|
12
14
|
|
13
15
|
jobs:
|
14
16
|
build_images:
|
@@ -35,6 +37,14 @@ jobs:
|
|
35
37
|
access_token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
36
38
|
cluster_name: ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
|
37
39
|
|
40
|
+
# For deploying images to Cloud Run
|
41
|
+
# - name: Connect to Cloud Run
|
42
|
+
# uses: ./.github/actions/connect-to-cloud-run@v1
|
43
|
+
# with:
|
44
|
+
# project_id: ${{ vars.GCP_PROJECT_ID }}
|
45
|
+
# project_number: ${{ vars.GCP_PROJECT_NUMBER }}
|
46
|
+
# region: ${{ vars.GCP_ARTIFACT_REGISTRY_REGION }}
|
47
|
+
|
38
48
|
- name: Build image
|
39
49
|
uses: ./.github/actions/build-image@v1
|
40
50
|
with:
|
@@ -59,15 +69,23 @@ jobs:
|
|
59
69
|
with:
|
60
70
|
access_token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
61
71
|
cluster_name: ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
|
62
|
-
|
72
|
+
|
73
|
+
# For deploying images to Cloud Run
|
74
|
+
# - name: Connect to Cloud Run
|
75
|
+
# uses: ./.github/actions/connect-to-cloud-run@v1
|
76
|
+
# with:
|
77
|
+
# project_id: ${{ vars.GCP_PROJECT_ID }}
|
78
|
+
# project_number: ${{ vars.GCP_PROJECT_NUMBER }}
|
79
|
+
# region: ${{ vars.GCP_ARTIFACT_REGISTRY_REGION }}
|
80
|
+
|
63
81
|
- name: Run DB Migrate
|
64
82
|
uses: ./.github/actions/db-migrate@v1
|
65
83
|
|
66
84
|
# Repeat per image (it checks if the image is affected and deploys it if it is)
|
67
85
|
- name: Deploy main node
|
68
|
-
uses: ./.github/actions/deploy-image@v1
|
86
|
+
uses: ./.github/actions/deploy-image-k8s@v1
|
69
87
|
with: { "image_name": "main-node" }
|
70
88
|
|
71
89
|
- name: Deploy main python
|
72
|
-
uses: ./.github/actions/deploy-image@v1
|
90
|
+
uses: ./.github/actions/deploy-image-k8s@v1
|
73
91
|
with: { "image_name": "main-python" }
|
@@ -9,6 +9,8 @@ on:
|
|
9
9
|
permissions:
|
10
10
|
contents: read
|
11
11
|
packages: read
|
12
|
+
# For deploying images to Cloud Run
|
13
|
+
# id-token: write
|
12
14
|
|
13
15
|
jobs:
|
14
16
|
build_images:
|
@@ -35,7 +37,15 @@ jobs:
|
|
35
37
|
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
|
36
38
|
zone: ${{ secrets.GCLOUD_ZONE }}
|
37
39
|
cluster_name: ${{ secrets.GCLOUD_CLUSTER_NAME }}
|
38
|
-
service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
|
40
|
+
service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
|
41
|
+
|
42
|
+
# For deploying images to Cloud Run
|
43
|
+
# - name: Connect to Cloud Run
|
44
|
+
# uses: ./.github/actions/connect-to-cloud-run@v1
|
45
|
+
# with:
|
46
|
+
# project_id: ${{ vars.GCP_PROJECT_ID }}
|
47
|
+
# project_number: ${{ vars.GCP_PROJECT_NUMBER }}
|
48
|
+
# region: ${{ vars.GCP_ARTIFACT_REGISTRY_REGION }}
|
39
49
|
|
40
50
|
- name: Build image
|
41
51
|
uses: ./.github/actions/build-image@v1
|
@@ -64,14 +74,22 @@ jobs:
|
|
64
74
|
cluster_name: ${{ secrets.GCLOUD_CLUSTER_NAME }}
|
65
75
|
service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
|
66
76
|
|
77
|
+
# For deploying images to Cloud Run
|
78
|
+
# - name: Connect to Cloud Run
|
79
|
+
# uses: ./.github/actions/connect-to-cloud-run@v1
|
80
|
+
# with:
|
81
|
+
# project_id: ${{ vars.GCP_PROJECT_ID }}
|
82
|
+
# project_number: ${{ vars.GCP_PROJECT_NUMBER }}
|
83
|
+
# region: ${{ vars.GCP_ARTIFACT_REGISTRY_REGION }}
|
84
|
+
|
67
85
|
- name: Run DB Migrate
|
68
86
|
uses: ./.github/actions/db-migrate@v1
|
69
87
|
|
70
88
|
# Repeat per image (it checks if the image is affected and deploys it if it is)
|
71
89
|
- name: Deploy main node
|
72
|
-
uses: ./.github/actions/deploy-image@v1
|
90
|
+
uses: ./.github/actions/deploy-image-k8s@v1
|
73
91
|
with: { "image_name": "main-node" }
|
74
92
|
|
75
93
|
- name: Deploy main python
|
76
|
-
uses: ./.github/actions/deploy-image@v1
|
94
|
+
uses: ./.github/actions/deploy-image-k8s@v1
|
77
95
|
with: { "image_name": "main-python" }
|
@@ -9,6 +9,8 @@ on:
|
|
9
9
|
permissions:
|
10
10
|
contents: read
|
11
11
|
packages: read
|
12
|
+
# For deploying images to Cloud Run
|
13
|
+
# id-token: write
|
12
14
|
|
13
15
|
jobs:
|
14
16
|
build_images:
|
@@ -34,7 +36,15 @@ jobs:
|
|
34
36
|
with:
|
35
37
|
kubeconfig: ${{ secrets.HCLOUD_KUBECONFIG }}
|
36
38
|
harbor_user: ${{ secrets.HARBOR_USER }}
|
37
|
-
harbor_password: ${{ secrets.HARBOR_PASSWORD }}
|
39
|
+
harbor_password: ${{ secrets.HARBOR_PASSWORD }}
|
40
|
+
|
41
|
+
# For deploying images to Cloud Run
|
42
|
+
# - name: Connect to Cloud Run
|
43
|
+
# uses: ./.github/actions/connect-to-cloud-run@v1
|
44
|
+
# with:
|
45
|
+
# project_id: ${{ vars.GCP_PROJECT_ID }}
|
46
|
+
# project_number: ${{ vars.GCP_PROJECT_NUMBER }}
|
47
|
+
# region: ${{ vars.GCP_ARTIFACT_REGISTRY_REGION }}
|
38
48
|
|
39
49
|
- name: Build image
|
40
50
|
uses: ./.github/actions/build-image@v1
|
@@ -60,16 +70,24 @@ jobs:
|
|
60
70
|
with:
|
61
71
|
kubeconfig: ${{ secrets.HCLOUD_KUBECONFIG }}
|
62
72
|
harbor_user: ${{ secrets.HARBOR_USER }}
|
63
|
-
harbor_password: ${{ secrets.HARBOR_PASSWORD }}
|
73
|
+
harbor_password: ${{ secrets.HARBOR_PASSWORD }}
|
74
|
+
|
75
|
+
# For deploying images to Cloud Run
|
76
|
+
# - name: Connect to Cloud Run
|
77
|
+
# uses: ./.github/actions/connect-to-cloud-run@v1
|
78
|
+
# with:
|
79
|
+
# project_id: ${{ vars.GCP_PROJECT_ID }}
|
80
|
+
# project_number: ${{ vars.GCP_PROJECT_NUMBER }}
|
81
|
+
# region: ${{ vars.GCP_ARTIFACT_REGISTRY_REGION }}
|
64
82
|
|
65
83
|
- name: Run DB Migrate
|
66
84
|
uses: ./.github/actions/db-migrate@v1
|
67
85
|
|
68
86
|
# Repeat per image (it checks if the image is affected and deploys it if it is)
|
69
87
|
- name: Deploy main node
|
70
|
-
uses: ./.github/actions/deploy-image@v1
|
88
|
+
uses: ./.github/actions/deploy-image-k8s@v1
|
71
89
|
with: { "image_name": "main-node" }
|
72
90
|
|
73
91
|
- name: Deploy main python
|
74
|
-
uses: ./.github/actions/deploy-image@v1
|
92
|
+
uses: ./.github/actions/deploy-image-k8s@v1
|
75
93
|
with: { "image_name": "main-python" }
|
@@ -0,0 +1,71 @@
|
|
1
|
+
name: "Deploy image"
|
2
|
+
description: "Deploy the specified image if it's affected and set its version"
|
3
|
+
inputs:
|
4
|
+
project_id:
|
5
|
+
description: 'The GCP project ID of the Cloud Run service'
|
6
|
+
required: true
|
7
|
+
image_name:
|
8
|
+
description: 'The image key in images.yaml'
|
9
|
+
required: true
|
10
|
+
region:
|
11
|
+
description: 'The region of the Cloud Run service'
|
12
|
+
required: true
|
13
|
+
sa_id:
|
14
|
+
description: 'The name of the service account used to run the Cloud Run service'
|
15
|
+
required: true
|
16
|
+
forward_env:
|
17
|
+
description: 'The environment variables to forward to the Cloud Run service (comma separated, e.g. ENV1,ENV2)'
|
18
|
+
required: false
|
19
|
+
allow_unauthenticated:
|
20
|
+
description: 'Whether to allow unauthenticated access to the Cloud Run service. Send "true" to allow unauthenticated access.'
|
21
|
+
required: false
|
22
|
+
outputs:
|
23
|
+
affected:
|
24
|
+
description: 'Whether the specified image is affected (computed before deploy)'
|
25
|
+
value: ${{ steps.check_affected.outputs.affected }}
|
26
|
+
runs:
|
27
|
+
using: "composite"
|
28
|
+
steps:
|
29
|
+
- name: Setup basic vars
|
30
|
+
shell: bash
|
31
|
+
run: |
|
32
|
+
echo "IMAGE_NAME=${{ inputs.image_name }}" >> $GITHUB_ENV
|
33
|
+
|
34
|
+
- name: Check if affected
|
35
|
+
id: check_affected
|
36
|
+
shell: bash
|
37
|
+
run: |
|
38
|
+
AFFECTED=$(devops affected image $IMAGE_NAME --from-live-version)
|
39
|
+
echo "affected=$AFFECTED" >> $GITHUB_OUTPUT
|
40
|
+
echo "affected=$AFFECTED"
|
41
|
+
if [[ "$AFFECTED" == "true" ]]; then
|
42
|
+
echo "${{ env.IMAGE_NAME }} is affected. Proceeding with deployment."
|
43
|
+
else
|
44
|
+
echo "${{ env.IMAGE_NAME }} is not affected. Skipping."
|
45
|
+
fi
|
46
|
+
|
47
|
+
- name: Deploy
|
48
|
+
shell: bash
|
49
|
+
if: steps.check_affected.outputs.affected == 'true'
|
50
|
+
run: |
|
51
|
+
RUNTIME_SA="${{ inputs.sa_id }}@${{ inputs.project_id }}.iam.gserviceaccount.com"
|
52
|
+
|
53
|
+
if [[ -z "${{ inputs.forward_env }}" ]]; then
|
54
|
+
FORWARD_ENV=""
|
55
|
+
else
|
56
|
+
FORWARD_ENV="--forward-env ${{ inputs.forward_env }}"
|
57
|
+
fi
|
58
|
+
|
59
|
+
if [[ "${{ inputs.allow_unauthenticated }}" == "true" ]]; then
|
60
|
+
ALLOW_UNAUTHENTICATED="--allow-unauthenticated"
|
61
|
+
else
|
62
|
+
ALLOW_UNAUTHENTICATED="--no-allow-unauthenticated"
|
63
|
+
fi
|
64
|
+
|
65
|
+
devops cloudrun deploy ${{ env.IMAGE_NAME }} ${{ github.sha }} \
|
66
|
+
--region ${{ inputs.region }} \
|
67
|
+
--service-account ${RUNTIME_SA} \
|
68
|
+
${FORWARD_ENV} \
|
69
|
+
${ALLOW_UNAUTHENTICATED}
|
70
|
+
|
71
|
+
devops image version set ${{ env.IMAGE_NAME }} ${{ github.sha }}
|