## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Settings" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!WARNING] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12783144157> > Commit: 0a2d9705b729c8429e7c79cc52bef0d78a51f390 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12783144157&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: @tag.Settings > Spec: > It seems like **no tests ran** 😔. We are not able to recognize it, please check <a href="https://github.com/appsmithorg/appsmith/actions/runs/12783144157" target="_blank">workflow here</a>. > <hr>Wed, 15 Jan 2025 07:01:28 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated description for PR number input parameter in GitHub Actions workflow configuration <!-- end of auto-generated comment: release notes by coderabbit.ai -->
128 lines
4.2 KiB
YAML
128 lines
4.2 KiB
YAML
name: Appsmith Build Docker Image Workflow
|
|
|
|
on:
|
|
# This line enables manual triggering of this workflow.
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
pr:
|
|
description: "This is the PR number in case the workflow is being called in a pull request"
|
|
required: false
|
|
type: number
|
|
|
|
jobs:
|
|
build-docker:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
github.event.pull_request.head.repo.full_name == github.repository ||
|
|
github.event_name == 'push' ||
|
|
github.event_name == 'workflow_dispatch' ||
|
|
github.event_name == 'repository_dispatch' ||
|
|
github.event_name == 'schedule'
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
# Check out merge commit
|
|
- name: Fork based /ok-to-test checkout
|
|
if: inputs.pr != 0
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: "refs/pull/${{ inputs.pr }}/merge"
|
|
|
|
# Checkout the code in the current branch in case the workflow is called because of a branch push event
|
|
- name: Checkout the head commit of the branch
|
|
if: inputs.pr == 0
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download the client build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: client-build
|
|
path: app/client
|
|
|
|
- name: Unpack the client build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
mkdir -p app/client/build
|
|
tar -xvf app/client/build.tar -C app/client/build
|
|
|
|
- name: Download the server build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: server-build
|
|
path: app/server/dist/
|
|
|
|
- name: Download the rts build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: rts-dist
|
|
path: app/client/packages/rts/dist
|
|
|
|
- name: Un-tar the rts folder
|
|
run: |
|
|
tar -xvf app/client/packages/rts/dist/rts-dist.tar -C app/client/packages/rts/
|
|
echo "Cleaning up the tar files"
|
|
rm app/client/packages/rts/dist/rts-dist.tar
|
|
|
|
- name: Generate info.json
|
|
run: |
|
|
if [[ -f scripts/generate_info_json.sh ]]; then
|
|
scripts/generate_info_json.sh
|
|
fi
|
|
|
|
- name: Place server artifacts-es
|
|
env:
|
|
EDITION: ${{ vars.EDITION }}
|
|
run: |
|
|
scripts/prepare_server_artifacts.sh
|
|
|
|
- name: Set base image tag
|
|
id: set_base_tag
|
|
run: |
|
|
if [[ "${{ inputs.pr }}" != 0 || "${{ github.ref_name }}" != master ]]; then
|
|
base_tag=release
|
|
else
|
|
base_tag=nightly
|
|
fi
|
|
echo "base_tag=$base_tag" >> $GITHUB_OUTPUT
|
|
|
|
|
|
# We don't use Depot Docker builds because it's faster for local Docker images to be built locally.
|
|
# It's slower and more expensive to build these Docker images on Depot and download it back to the CI node.
|
|
- name: Build docker image
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: "."
|
|
run: |
|
|
set -o xtrace
|
|
declare -a args
|
|
base_tag=${{ steps.set_base_tag.outputs.base_tag }}
|
|
if [[ base_tag != 'nightly' ]]; then
|
|
args+=(--build-arg "APPSMITH_CLOUD_SERVICES_BASE_URL=https://release-cs.appsmith.com")
|
|
fi
|
|
args+=(--build-arg "BASE=${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:$base_tag")
|
|
docker build -t cicontainer "${args[@]}" .
|
|
|
|
# Saving the docker image to tar file
|
|
- name: Save Docker image to tar file
|
|
run: |
|
|
docker image ls --all --no-trunc --format '{{.Repository}},{{.ID}}' \
|
|
| grep -v cicontainer \
|
|
| cut -d, -f2 \
|
|
| xargs -r docker rmi || true
|
|
docker save cicontainer -o cicontainer.tar
|
|
gzip cicontainer.tar
|
|
|
|
- name: Cache docker image
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: cicontainer.tar.gz
|
|
key: docker-image-${{github.run_id}}
|
|
|
|
- name: Save the status of the run
|
|
run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result
|