ci: Fixing the RTS build workflow (#16748)

## Description

The problem with the RTS workflow after the induction of AST parsing was that while copying the `node_modules`, Ubuntu doesn't follow the symlink and copy the content. It simply copies the symlink as is. This causes issues for RTS service to start.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

- Personal repository

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
This commit is contained in:
Arpit Mohan 2022-09-14 10:54:20 +02:00 committed by GitHub
parent 16b04f33a6
commit 7580eb9990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 49 deletions

View File

@ -63,7 +63,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result

View File

@ -83,7 +83,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -477,7 +477,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result

View File

@ -60,7 +60,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result

View File

@ -62,7 +62,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -129,7 +129,7 @@ jobs:
if: steps.run_result.outputs.run_result != 'success' if: steps.run_result.outputs.run_result != 'success'
run: | run: |
echo 'export const VERSION = "${{ steps.vars.outputs.version }}"' > src/version.js echo 'export const VERSION = "${{ steps.vars.outputs.version }}"' > src/version.js
./build.sh yarn build
# Restore the previous built bundle if present. If not push the newly built into the cache # Restore the previous built bundle if present. If not push the newly built into the cache
- name: Restore the previous bundle - name: Restore the previous bundle
@ -141,18 +141,18 @@ jobs:
restore-keys: | restore-keys: |
${{ github.run_id }}-${{ github.job }} ${{ github.run_id }}-${{ github.job }}
# Tar the bundles to speed up the upload & download process
- name: Tar the rts bundles
run: |
ls -al dist/node_modules/@shared/ast
tar -cvf rts-dist.tar dist
# Upload the build artifacts and dependencies so that it can be used by the test & deploy job in other workflows # Upload the build artifacts and dependencies so that it can be used by the test & deploy job in other workflows
- name: Upload rts build bundle - name: Upload rts build bundle
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: rts-build name: rts-dist
path: app/rts/dist/ path: app/rts/rts-dist.tar
- name: Upload RTS dependencies bundle
uses: actions/upload-artifact@v2
with:
name: rts-build-deps
path: app/rts/node_modules/
# Set status = success # Set status = success
- run: echo "::set-output name=run_result::success" > ~/run_result - run: echo "::set-output name=run_result::success" > ~/run_result

View File

@ -69,7 +69,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result

View File

@ -54,7 +54,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -203,7 +203,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -318,7 +318,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -366,8 +366,7 @@ jobs:
if: steps.run_result.outputs.run_result != 'success' if: steps.run_result.outputs.run_result != 'success'
run: | run: |
echo 'export const VERSION = "${{ steps.vars.outputs.version }}"' > src/version.js echo 'export const VERSION = "${{ steps.vars.outputs.version }}"' > src/version.js
./build.sh yarn build
ls -l dist
# Restore the previous built bundle if present. If not push the newly built into the cache # Restore the previous built bundle if present. If not push the newly built into the cache
- name: Restore the previous bundle - name: Restore the previous bundle
@ -379,28 +378,22 @@ jobs:
restore-keys: | restore-keys: |
${{ github.run_id }}-${{ github.job }} ${{ github.run_id }}-${{ github.job }}
# Restore the previous built bundle if present. If not push the newly built into the cache # Tar the bundles to speed up the upload & download process
- name: Restore the previous bundle - name: Tar the rts bundles
uses: actions/cache@v2 run: |
with: ls -al dist/node_modules/@shared/ast
path: | tar -cvf rts-dist.tar dist
app/rts/node_modules/
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
${{ github.run_id }}-${{ github.job }}
# Upload the build artifact so that it can be used by the test & deploy job in the workflow # Upload the build artifact so that it can be used by the test & deploy job in the workflow
- name: Upload server build bundle - name: Upload server build bundle
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: rts-build name: rts-dist
path: app/rts/dist/ path: app/rts/rts-dist.tar
# Set status = success
- run: echo "::set-output name=run_result::success" > ~/run_result
- name: Upload RTS dependencies bundle
uses: actions/upload-artifact@v2
with:
name: rts-build-deps
path: app/rts/node_modules/
perf-test: perf-test:
needs: [buildClient, buildServer, buildRts] needs: [buildClient, buildServer, buildRts]
@ -439,7 +432,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -665,7 +658,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -1072,7 +1065,7 @@ jobs:
# Timestamp will be used to create cache key # Timestamp will be used to create cache key
- id: timestamp - id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')" run: echo "::set-output name=timestamp::$(date +'%Y-%m-%dT%H:%M:%S')"
# In case this is second attempt try restoring status of the prior attempt from cache # In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result - name: Restore the previous run result
@ -1540,14 +1533,14 @@ jobs:
- name: Download the rts build artifact - name: Download the rts build artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: rts-build name: rts-dist
path: app/rts/dist path: app/rts/dist
- name: Download the rts build artifact - name: Untar the rts folder
uses: actions/download-artifact@v2 run: |
with: tar -xvf app/rts/dist/rts-dist.tar -C app/rts/
name: rts-build-deps echo "Cleaning up the tar files"
path: app/rts/node_modules/ rm app/rts/dist/rts-dist.tar
# Here, the GITHUB_REF is of type /refs/head/<branch_name>. We extract branch_name from this by removing the # Here, the GITHUB_REF is of type /refs/head/<branch_name>. We extract branch_name from this by removing the
# first 11 characters. This can be used to build images for several branches # first 11 characters. This can be used to build images for several branches
@ -1656,7 +1649,6 @@ jobs:
tags: | tags: |
${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:${{ github.sha }} ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:${{ github.sha }}
${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:nightly ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:nightly
# Build release Docker image and push to Docker Hub # Build release Docker image and push to Docker Hub
- name: Push RTS release image to Docker Hub - name: Push RTS release image to Docker Hub
if: success() && github.ref == 'refs/heads/release' if: success() && github.ref == 'refs/heads/release'

View File

@ -5,5 +5,7 @@ set -o errexit
cd "$(dirname "$0")" cd "$(dirname "$0")"
yarn install --frozen-lockfile yarn install --frozen-lockfile
npx tsc && npx tsc-alias npx tsc && npx tsc-alias
# Copying node_modules directory into dist as rts server requires node_modules to run server build properly. This was previously being done in dockerfile which was copying the symlinks to image rather than the whole directory of shared modules (e.g. AST) # Copying node_modules directory into dist as rts server requires node_modules to run server build properly.
cp -r node_modules ./dist # This was previously being done in dockerfile which was copying the symlinks to image rather than the whole directory of shared modules (e.g. AST)
# Also, we copy node_modules with -L flag in order to follow the symlinks for @shared folder and copy the contents instead of just the symlink
cp -rL node_modules ./dist

View File

@ -1 +1 @@
{"id":"ts81441f91"} { "id": "ts81441f91" }