-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (121 loc) · 5.52 KB
/
build-release-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build and release image
on:
workflow_run:
workflows: ["Build and test image"]
types:
- completed
branches: ["v*.*.*"]
workflow_dispatch:
concurrency:
group: falkordb-node-release
cancel-in-progress: true
env:
NODE_IMAGE_NAME: falkordb-node
CLUSTER_IMAGE_NAME: falkordb-cluster
FALKORDB_VERSION: v4.4.1
CLUSTER_REBALANCE_IMAGE_NAME: falkordb-cluster-rebalance
jobs:
build-and-push:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- dockerfile: ./falkordb-node/Dockerfile
image-name: falkordb-node
- dockerfile: ./falkordb-cluster/Dockerfile
image-name: falkordb-cluster
- dockerfile: ./falkordb-cluster-rebalance/Dockerfile
image-name: falkordb-cluster-rebalance
steps:
- run: ${{ tojson(github.event) }}
shell: cat {0}
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
build-args: FALKORDB_VERSION=${{ env.FALKORDB_VERSION }}
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: falkordb/${{ matrix.image-name }}:${{ github.event.workflow_run.head_branch }}, falkordb/${{ matrix.image-name }}:latest
omnistrate-update-plans:
needs: build-and-push
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
plans:
- name: FalkorDB
file: omnistrate.free.yaml
key: free
- name: FalkorDB
file: omnistrate.pro.yaml
key: pro
- name: FalkorDB
file: omnistrate.enterprise.yaml
key: enterprise
- name: FalkorDB
file: omnistrate.startup.yaml
key: startup
steps:
- name: Checkout
if: ${{ contains(vars.OMNISTRATE_RELEASE_PLANS, matrix.plans.key) }}
uses: actions/checkout@v4
- name: Replace Variables
if: ${{ contains(vars.OMNISTRATE_RELEASE_PLANS, matrix.plans.key) }}
run: |
sed -i 's/$GcpProjectId/${{ vars.GCP_PROJECT_ID }}/g' ${{ matrix.plans.file }}
sed -i 's/$GcpProjectNumber/${{ vars.GCP_PROJECT_NUMBER }}/g' ${{ matrix.plans.file }}
sed -i 's/$GcpServiceAccountEmail/${{ vars.GCP_SERVICE_ACCOUNT_EMAIL }}/g' ${{ matrix.plans.file }}
sed -i 's/$AwsAccountId/${{ vars.AWS_ACCOUNT_ID }}/g' ${{ matrix.plans.file }}
sed -i 's|$AwsBootstrapRoleAccountArn|${{ vars.AWS_BOOTSTRAP_ROLE_ACCOUNT_ARN }}|g' ${{ matrix.plans.file }}
sed -i 's/$FalkorDBNodeImage/falkordb\/${{ env.NODE_IMAGE_NAME }}:${{ github.event.workflow_run.head_branch }}/g' ${{ matrix.plans.file }}
sed -i 's/$FalkorDBClusterImage/falkordb\/${{ env.CLUSTER_IMAGE_NAME }}:${{ github.event.workflow_run.head_branch }}/g' ${{ matrix.plans.file }}
sed -i 's/$FalkorDBClusterRebalanceImage/falkordb\/${{ env.CLUSTER_REBALANCE_IMAGE_NAME }}:${{ github.event.workflow_run.head_branch }}/g' ${{ matrix.plans.file }}
- name: Remove e2-machine from pro and enterprise
if: ${{ contains( vars.OMNISTRATE_RELEASE_PLANS, matrix.plans.key) && (matrix.plans.key == 'pro' || matrix.plans.key == 'enterprise') }}
run: |
sed -i 's/- e2-medium//g' ${{ matrix.plans.file }}
sed -i 's/- t2.medium//g' ${{ matrix.plans.file }}
- name: Upload yaml to artifacts
if: ${{ contains(vars.OMNISTRATE_RELEASE_PLANS, matrix.plans.key) }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.plans.file }}
path: ${{ matrix.plans.file }}
- name: Create FALKORDB_PASSWORD/ADMIN_PASSWORD files
run: |
export sec=$(grep '^secrets' omnistrate.free.yaml)
if [[ -n "$sec" ]];then
mkdir -p secrets || { echo "Failed to create secrets directory"; exit 1; }
echo '{{ $var.falkordbPassword }}' > ./secrets/falkordbpassword || { echo "Failed to write falkordbpassword"; exit 1; }
echo '{{ $func.random(string, 16, $sys.deterministicSeedValue) }}' > ./secrets/adminpassword || { echo "Failed to write adminpassword"; exit 1; }
echo '{{ $var.adminPassword }}' > ./secrets/grafana_admin_password || { echo "Failed to write grafana_admin_password"; exit 1; }
echo '{{ $func.random(string, 16, $sys.deterministicSeedValue) }}' > ./secrets/grafana_secret_key || { echo "Failed to write grafana_secret_key"; exit 1; }
echo '{{ $var.smtpPassword }}' > ./secrets/grafana_smtp_password || { echo "Failed to write grafana_smtp_password"; exit 1; }
else
echo "secrets option was not used"
exit 0
fi
- name: Update Omnistrate plan
if: ${{ contains(vars.OMNISTRATE_RELEASE_PLANS, matrix.plans.key) }}
uses: ./.github/actions/update-omnistrate-plan
with:
username: ${{ secrets.OMNISTRATE_USERNAME }}
password: ${{ secrets.OMNISTRATE_PASSWORD }}
file: ${{ matrix.plans.file }}
service-name: ${{ matrix.plans.name }}
environment: dev
environment-type: dev
release-description: "${{ github.event.workflow_run.head_branch }}"