This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
global: change the project structure * It merges Airflow and Django into a mono repo, it has breaking changes.
- Loading branch information
Showing
205 changed files
with
2,100 additions
and
793 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,17 +17,5 @@ jobs: | |
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: black | ||
uses: psf/black@stable | ||
with: | ||
options: "--verbose" | ||
|
||
- name: run flake8 | ||
uses: julianwachholz/flake8-action@v2 | ||
with: | ||
checkName: "flake8" | ||
- name: Pre-commit check | ||
uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Pull request main | ||
|
||
on: | ||
pull_request_target: | ||
branches: [main] | ||
paths: | ||
- 'backoffice/**' | ||
|
||
jobs: | ||
lint: | ||
uses: ./.github/workflows/lint.yml | ||
with: | ||
ref: ${{ github.ref }} | ||
test: | ||
uses: ./.github/workflows/backoffice/test.yml | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Push main | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'backoffice/**' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
lint: | ||
uses: ./.github/workflows/lint.yml | ||
with: | ||
ref: ${{ github.ref }} | ||
test: | ||
needs: lint | ||
uses: ./.github/workflows/backoffice/test.yml | ||
with: | ||
ref: ${{ github.ref }} | ||
secrets: inherit | ||
deploy: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: send event | ||
uses: cern-sis/gh-workflows/.github/actions/[email protected] | ||
with: | ||
event-type: update | ||
images: | | ||
cern-sis/inspire/backoffice@${{ needs.test.outputs.image-id }} | ||
token: ${{ secrets.PAT_FIRE_EVENTS_ON_CERN_SIS_KUBERNETES }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: The reference to build | ||
type: string | ||
required: true | ||
outputs: | ||
image-id: | ||
description: The ID of image that has been built | ||
value: ${{ jobs.build.outputs.image-id }} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
ref: ${{ inputs.ref }} | ||
image: cern-sis/inspire/workflows | ||
secrets: inherit | ||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
services: | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
postgres: | ||
image: postgres:13 | ||
env: | ||
POSTGRES_USER: airflow | ||
POSTGRES_PASSWORD: airflow | ||
POSTGRES_DB: airflow | ||
ports: | ||
- 5432:5432 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Test | ||
run: > | ||
docker run | ||
--network=host | ||
-v "$(pwd)"/tests:/opt/airflow/tests | ||
-v "$(pwd)"/airflow.cfg:/opt/airflow/airflow.cfg | ||
-v "$(pwd)"/requirements-test.txt:/opt/airflow/requirements-test.txt | ||
-v "$(pwd)"/data:/opt/airflow/data | ||
registry.cern.ch/cern-sis/inspire/workflows@${{ needs.build.outputs.image-id }} | ||
bash -c "pip install -r requirements-test.txt && airflow db init && pytest /opt/airflow/tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: "22.8.0" | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v2.7.1" | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: name-tests-test | ||
args: [ --pytest-test-first ] | ||
exclude: '^(?!factories/)' | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.5.2 | ||
hooks: | ||
- id: prettier | ||
- repo: https://github.com/pycqa/isort | ||
rev: "5.12.0" | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: "3.9.2" | ||
hooks: | ||
- id: flake8 | ||
args: ["--config=setup.cfg"] | ||
- id: ruff | ||
args: [ --fix, --unsafe-fixes ] | ||
- id: ruff-format |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Makefile | ||
|
||
# Set the AIRFLOW_HOME environment variable | ||
export AIRFLOW_HOME=$(shell pwd)/workflows | ||
export AIRFLOW_PROJ_DIR=$(AIRFLOW_HOME) | ||
|
||
# Default target | ||
all: run | ||
|
||
run: | ||
docker-compose up | ||
|
||
clean: | ||
docker-compose down | ||
|
||
init: backoffice-init workflows-init | ||
|
||
backoffice-init: | ||
docker-compose exec backoffice-webserver python manage.py create_groups | ||
docker-compose exec backoffice-webserver python manage.py loaddata backoffice/users/fixtures/users.json | ||
docker-compose exec backoffice-webserver python manage.py loaddata backoffice/users/fixtures/tokens.json | ||
echo "Backoffice initialized" | ||
|
||
workflows-init: | ||
docker-compose exec airflow-webserver /entrypoint airflow connections import ./scripts/connections/connections.json | ||
docker-compose exec airflow-webserver /entrypoint airflow variables import ./scripts/variables/variables.json | ||
echo "\033[31mCHANGE inspire_token in Admin->Variables\033[0m" | ||
echo "Workflows initialized" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# PostgreSQL | ||
# ------------------------------------------------------------------------------ | ||
POSTGRES_HOST=postgres | ||
POSTGRES_HOST=postgres-backoffice | ||
POSTGRES_PORT=5432 | ||
POSTGRES_DB=inspire | ||
POSTGRES_USER=inspire | ||
POSTGRES_PASSWORD=inspire | ||
POSTGRES_PASSWORD=inspire |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__version__ = "0.1.0" | ||
__version_info__ = tuple( | ||
int(num) if num.isdigit() else num | ||
for num in __version__.replace("-", ".", 1).split(".") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("sites", "0001_initial")] | ||
|
||
operations = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("sites", "0003_set_site_domain_and_name"), | ||
] | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.