Build and release image #207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |