Compare commits

...
Sign in to create a new pull request.

10 commits

Author SHA1 Message Date
rjshrjndrn
a235825981 fix(ci): maintain correct working directory in workflow
Adds working_dir variable to track the initial directory and ensures
proper directory navigation when processing services in the release
deployment workflow.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 16:18:39 +01:00
rjshrjndrn
ecd33e87bd fix(workflow): move wait outside build services loop
The wait command was placed inside the service loop,
causing the workflow to wait after each individual service build.
Moving it outside ensures all service builds run in parallel before
proceeding to the next step.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 16:15:30 +01:00
rjshrjndrn
08e074d92a fix(ci): add missing loop closures in deploy workflow
Add the required 'done' keywords at the end of for loops in the
Kubernetes deployment steps for both EE and FOSS clusters to ensure
proper script execution.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 16:12:55 +01:00
rjshrjndrn
f3c3df5d47 perf(ci): parallelize FOSS and EE build steps
Improves build performance by running EE and FOSS builds in parallel
using depot's parallel build capabilities. Each service's builds now
run concurrently with proper process management via Bash background
jobs, reducing overall build time.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 16:03:32 +01:00
rjshrjndrn
55677eb33a refactor(ci): simplify image tag format
The image tag generation in the release deployment workflow was simplified
by removing the redundant IMAGE_TAG variable prepending. Now the tag is
directly composed of the branch name and short SHA, resulting in cleaner
and more readable image tags.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 16:00:00 +01:00
rjshrjndrn
a8f494bc15 feat: add enterprise edition image build and deployment
Add parallel Enterprise Edition (-ee suffix) image building and update
K8s deployments to use the EE images in the EE cluster. This change
enables maintaining both community and enterprise edition deployments
from the same workflow.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 15:55:13 +01:00
rjshrjndrn
0c454df2eb fix(actions): set default build script name before service loop
The workflow was missing a default value for the BUILD_SCRIPT_NAME
variable, which could cause failures when processing services. This
commit adds "build.sh" as the default value.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 15:49:28 +01:00
rjshrjndrn
1e0499e31d fix(actions): standardize registry URL in workflows
Replace all instances of RELEASE_OSS_REGISTRY secret with the already
defined IMAGE_REGISTRY_URL environment variable for consistency across
deployment steps. This eliminates duplicate references to the same
registry URL and simplifies future maintenance.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 15:36:34 +01:00
rjshrjndrn
3a71baaaf9 feat(ci): add DEPOT_TOKEN to release workflow env
Add the DEPOT_TOKEN secret to the environment variables section of the
release-deployment workflow to enable proper authentication with the
Depot service for Docker builds.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 14:05:56 +01:00
rjshrjndrn
76847883ef refactor(ci): revamp release deployment workflow
Completely redesign the release deployment workflow to:
- Simplify image building and deployment process
- Add branch-based tagging with commit SHA
- Replace AWS ECR login with direct Docker registry auth
- Improve service deployment with explicit image setting
- Update naming and descriptions for better clarity

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-03-06 14:05:55 +01:00

View file

@ -0,0 +1,103 @@
name: Release Deployment
on:
workflow_dispatch:
inputs:
services:
description: 'Comma-separated list of services to deploy'
required: true
branch:
description: 'Branch to deploy (defaults to dev)'
required: false
default: 'dev'
env:
IMAGE_REGISTRY_URL: ${{ secrets.OSS_REGISTRY_URL }}
DEPOT_PROJECT_ID: ${{ secrets.DEPOT_PROJECT_ID }}
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- name: Docker login
run: |
docker login $IMAGE_REGISTRY_URL -u ${{ secrets.OSS_DOCKER_USERNAME }} -p "${{ secrets.OSS_REGISTRY_TOKEN }}"
- name: Set image tag with branch info
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "IMAGE_TAG=${{ github.event.inputs.branch }}-${SHORT_SHA}" >> $GITHUB_ENV
echo "Using image tag: $IMAGE_TAG"
- uses: depot/setup-action@v1
- name: Build and push Docker images
run: |
# Parse the comma-separated services list into an array
IFS=',' read -ra SERVICES <<< "${{ github.event.inputs.services }}"
working_dir=$(pwd)
# Define backend services (consider moving this to workflow inputs or repo config)
ls backend/cmd >> /tmp/backend.txt
BUILD_SCRIPT_NAME="build.sh"
for SERVICE in "${SERVICES[@]}"; do
# Check if service is backend
if grep -q $SERVICE /tmp/backend.txt; then
cd $working_dir/backend
foss_build_args="nil $SERVICE"
ee_build_args="ee $SERVICE"
else
cd $working_dir
[[ $SERVICE == 'chalice' || $SERVICE == 'alerts' || $SERVICE == 'crons' ]] && cd $working_dir/api || cd $SERVICE
[[ $SERVICE == 'alerts' || $SERVICE == 'crons' ]] && BUILD_SCRIPT_NAME="build_${SERVICE}.sh"
ee_build_args="ee"
fi
{
echo IMAGE_TAG=$IMAGE_TAG DOCKER_RUNTIME="depot" DOCKER_BUILD_ARGS="--push" ARCH=amd64 DOCKER_REPO=$IMAGE_REGISTRY_URL PUSH_IMAGE=0 bash ${BUILD_SCRIPT_NAME} $foss_build_args
IMAGE_TAG=$IMAGE_TAG DOCKER_RUNTIME="depot" DOCKER_BUILD_ARGS="--push" ARCH=amd64 DOCKER_REPO=$IMAGE_REGISTRY_URL PUSH_IMAGE=0 bash ${BUILD_SCRIPT_NAME} $foss_build_args
}&
{
echo IMAGE_TAG=${IMAGE_TAG}-ee DOCKER_RUNTIME="depot" DOCKER_BUILD_ARGS="--push" ARCH=amd64 DOCKER_REPO=$IMAGE_REGISTRY_URL PUSH_IMAGE=0 bash ${BUILD_SCRIPT_NAME} $ee_build_args
IMAGE_TAG=${IMAGE_TAG}-ee DOCKER_RUNTIME="depot" DOCKER_BUILD_ARGS="--push" ARCH=amd64 DOCKER_REPO=$IMAGE_REGISTRY_URL PUSH_IMAGE=0 bash ${BUILD_SCRIPT_NAME} $ee_build_args
}&
done
wait
- uses: azure/k8s-set-context@v1
name: Using ee release cluster
with:
method: kubeconfig
kubeconfig: ${{ secrets.EE_RELEASE_KUBECONFIG }}
- name: Deploy to ee release Kubernetes
run: |
echo "Deploying services to EE cluster: ${{ github.event.inputs.services }}"
IFS=',' read -ra SERVICES <<< "${{ github.event.inputs.services }}"
for SERVICE in "${SERVICES[@]}"; do
SERVICE=$(echo $SERVICE | xargs) # Trim whitespace
echo "Deploying $SERVICE to EE cluster with image tag: ${IMAGE_TAG}"
kubectl set image deployment/$SERVICE-openreplay -n app $SERVICE=${IMAGE_REGISTRY_URL}/$SERVICE:${IMAGE_TAG}-ee
done
- uses: azure/k8s-set-context@v1
name: Using foss release cluster
with:
method: kubeconfig
kubeconfig: ${{ secrets.FOSS_RELEASE_KUBECONFIG }}
- name: Deploy to FOSS release Kubernetes
run: |
echo "Deploying services to FOSS cluster: ${{ github.event.inputs.services }}"
IFS=',' read -ra SERVICES <<< "${{ github.event.inputs.services }}"
for SERVICE in "${SERVICES[@]}"; do
SERVICE=$(echo $SERVICE | xargs) # Trim whitespace
echo "Deploying $SERVICE to FOSS cluster with image tag: ${IMAGE_TAG}"
echo "Deploying $SERVICE to FOSS cluster with image tag: ${IMAGE_TAG}"
kubectl set image deployment/$SERVICE-openreplay -n app $SERVICE=${IMAGE_REGISTRY_URL}/$SERVICE:${IMAGE_TAG}
done