Skip to content

Backend functionality for getting current logged in user's information from canonical directory, and storing it in users table upon login #422

Backend functionality for getting current logged in user's information from canonical directory, and storing it in users table upon login

Backend functionality for getting current logged in user's information from canonical directory, and storing it in users table upon login #422

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- run: yarn lint
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- run: yarn test
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- run: CI=false yarn build
lint-python:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install ruff
- name: Lint
run: ruff check
run-python:
name: Run Python
runs-on: ubuntu-latest
services:
valkey:
image: valkey/valkey
options: >-
--health-cmd "valkey-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run service
env:
GOOGLE_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
GOOGLE_PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }}
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
SECRET_KEY: secret_key
VALKEY_HOST: localhost
VALKEY_PORT: 6379
GH_TOKEN: token
REPO_ORG: https://github.com/canonical
JIRA_EMAIL: example@canonical.com
JIRA_TOKEN: jiratoken
JIRA_URL: https://example.atlassian.net
JIRA_LABELS: somelabel
JIRA_COPY_UPDATES_EPIC: WD-9999999
GOOGLE_DRIVE_FOLDER_ID: folderid
COPYDOC_TEMPLATE_ID: templateid
run: |
gunicorn webapp.app:app --daemon --bind 0.0.0.0:8104
curl --head --fail --retry-delay 1 --retry 30 --retry-connrefused http://localhost:8104
run-image:
name: Run Image
runs-on: ubuntu-latest
timeout-minutes: 15
services:
valkey:
image: valkey/valkey
options: >-
--health-cmd "valkey-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Build image
run: DOCKER_BUILDKIT=1 docker build --tag websites-content-system .
- name: Run image
env:
GOOGLE_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
GOOGLE_PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }}
run: |
docker run \
-p 8104:8104 \
-e SECRET_KEY=secret_key \
-e VALKEY_HOST=localhost \
-e VALKEY_PORT=6379 \
-e GH_TOKEN=token \
-e REPO_ORG=https://github.com/canonical \
-e DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres \
-e JIRA_EMAIL=example@canonical.com \
-e JIRA_TOKEN=jiratoken \
-e JIRA_URL=https://example.atlassian.net \
-e JIRA_LABELS=somelabel \
-e JIRA_COPY_UPDATES_EPIC=WD-9999999 \
-e GOOGLE_DRIVE_FOLDER_ID=folderid \
-e COPYDOC_TEMPLATE_ID=templateid \
-e GOOGLE_PRIVATE_KEY="$GOOGLE_PRIVATE_KEY" \
-e GOOGLE_PRIVATE_KEY_ID="$GOOGLE_PRIVATE_KEY_ID" \
--network host \
websites-content-system & sleep 1
curl --head --fail --retry-delay 1 --retry 30 --retry-connrefused http://localhost