Skip to content

chore(ora): simplify build_modules.js, add linting + libs forward-compat, wire publish workflow [sc-550202] #1159

chore(ora): simplify build_modules.js, add linting + libs forward-compat, wire publish workflow [sc-550202]

chore(ora): simplify build_modules.js, add linting + libs forward-compat, wire publish workflow [sc-550202] #1159

Workflow file for this run

name: Redshift dedicated env
on:
pull_request:
types: [closed, unlabeled, labeled, synchronize]
env:
NODE_VERSION: 14
PYTHON_VERSION: 3.10.13
VIRTUALENV_VERSION: 20.15.1
jobs:
dedicated:
if: |
github.event.label.name == 'dedicated_redshift' ||
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'dedicated_redshift')) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'dedicated_redshift'))
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
RS_HOST: ${{ secrets.RS_HOST_CD }}
RS_DATABASE: ${{ secrets.RS_DATABASE_CD }}
RS_USER: ${{ secrets.RS_USER_CD }}
RS_PASSWORD: ${{ secrets.RS_PASSWORD_CD }}
RS_LAMBDA_INVOKE_ROLE: ${{ secrets.RS_LAMBDA_INVOKE_ROLE_CD }}
RS_LAMBDA_EXECUTION_ROLE: ${{ secrets.RS_LAMBDA_EXECUTION_ROLE_CD }}
AWS_REGION: ${{ secrets.RS_REGION_CD }}
AWS_ACCESS_KEY_ID: ${{ secrets.RS_AWS_ACCESS_KEY_ID_CD }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RS_AWS_SECRET_ACCESS_KEY_CD }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set RS_PREFIX for releases
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
echo "RS_PREFIX=dedicated_release_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set RS_PREFIX for hotfixes
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
echo "RS_PREFIX=dedicated_hotfix_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set RS_PREFIX for the rest
if: |
!(startsWith(github.event.pull_request.head.ref, 'hotfix/')) &&
!(startsWith(github.event.pull_request.head.ref, 'release/'))
run: echo "RS_PREFIX=dedicated_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup yarn
run: npm install -g yarn
- name: Fix apt sources for Debian Buster
run: |
sudo sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list
sudo sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list
echo 'Acquire::Check-Valid-Until "false";' | sudo tee /etc/apt/apt.conf.d/99no-check-valid
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install rsync zip unzip curl glibc-source groff less
- name: Install AWS CLI
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
- name: Setup virtualenv
run: pip install virtualenv==${{ env.VIRTUALENV_VERSION }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.RS_AWS_ACCESS_KEY_ID_CD }}
aws-secret-access-key: ${{ secrets.RS_AWS_SECRET_ACCESS_KEY_CD }}
aws-region: ${{ secrets.RS_REGION_CD }}
- name: Set RS_LAMBDA_PREFIX
run: echo "RS_LAMBDA_PREFIX=ded-${{ github.event.pull_request.number }}-" >> $GITHUB_ENV
- name: Run deploy
id: deploy
if: github.event.action == 'synchronize' || github.event.action == 'labeled'
run: |
make deploy cloud=redshift
- name: Run remove
id: remove
if: github.event.action == 'unlabeled' || github.event.action == 'closed'
run: |
make remove cloud=redshift drop-schema=1 || echo "Removal (best effort)"
- name: Comment deploy PR
if: steps.deploy.outcome == 'success' && github.event.action == 'labeled'
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Dedicated ${{ env.RS_PREFIX }}carto environment deployed in Redshift host ${{ env.RS_HOST }} and ${{ env.RS_DATABASE }} database
- Gateway functions (Lambda): ${{ env.RS_LAMBDA_PREFIX }}*
- Clouds functions (SQL UDFs): deployed
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment remove PR
if: steps.remove.outcome == 'success' && (github.event.action == 'unlabeled' || github.event.action == 'closed')
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Dedicated environment removed
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}