-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Gowtham1729/feature/fetcher
Add Data Fetcher skeleton
- Loading branch information
Showing
13 changed files
with
735 additions
and
7 deletions.
There are no files selected for viewing
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,73 @@ | ||
name: Build Fetcher | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: | ||
- "applications/data_fetcher/**" | ||
|
||
concurrency: | ||
group: build-group | ||
cancel-in-progress: false | ||
|
||
env: | ||
PROJECT_ID: ${{ secrets.GKE_PROJECT }} | ||
GAR_LOCATION: us-central1 | ||
|
||
jobs: | ||
setup-build-publish: | ||
name: Setup, Build, Publish | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
permissions: | ||
contents: 'write' | ||
id-token: 'write' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Set up Taskfile | ||
uses: arduino/[email protected] | ||
|
||
- name: Run Lint Check | ||
run: task lint-check | ||
|
||
- name: Run all tests | ||
run: task test | ||
|
||
# Authentication to GCP via credentials json | ||
- id: 'auth' | ||
uses: 'google-github-actions/auth@v1' | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
|
||
- name: Docker configuration | ||
run: gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev --quiet | ||
|
||
- name: Build | ||
run: task build-fetcher-image tag="$GITHUB_SHA" | ||
|
||
# Push the Docker image to Google Artifact Registry | ||
- name: Publish | ||
run: task push-fetcher-image tag="$GITHUB_SHA" | ||
|
||
- name: Replace Fetcher Image Tag | ||
run: sed -i "s/\(&fetcherImageTag\) [^[:space:]]*/\1 $GITHUB_SHA/g" infrastructure/k8s/folio-feed-helm/values.yaml | ||
|
||
- name: Commit the Changes | ||
run: | | ||
git config user.name "Github Actions" | ||
git config user.email [email protected] | ||
git diff | ||
git add infrastructure/k8s/folio-feed-helm/values.yaml | ||
git commit -m "fetcher image update: $GITHUB_SHA" | ||
git push origin main |
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
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 @@ | ||
FROM --platform=linux/amd64 python:3.11-buster as builder | ||
|
||
RUN pip install poetry==1.6.1 | ||
|
||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=1 \ | ||
POETRY_VIRTUALENVS_CREATE=1 \ | ||
POETRY_CACHE_DIR=/tmp/poetry_cache | ||
|
||
WORKDIR /app | ||
|
||
COPY pyproject.toml poetry.lock ./ | ||
|
||
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev | ||
|
||
FROM --platform=linux/amd64 python:3.11-slim-buster as runtime | ||
|
||
ENV VIRTUAL_ENV=/app/.venv \ | ||
PATH="/app/.venv/bin:$PATH" | ||
|
||
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} | ||
|
||
WORKDIR /app | ||
COPY fetcher.py /app | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["python", "fetcher.py"] |
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 @@ | ||
print(f"Fetcher is running...") |
Large diffs are not rendered by default.
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,25 @@ | ||
[tool.poetry] | ||
name = "data-fetcher" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["gowtham1729 <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
requests = "^2.31.0" | ||
click = "^8.1.7" | ||
psycopg = "^3.1.13" | ||
pika = "^1.3.2" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
isort = "^5.12.0" | ||
black = "^23.11.0" | ||
mypy = "^1.7.1" | ||
pytest = "^7.4.3" | ||
pytest-cov = "^4.1.0" | ||
pytest-xdist = "^3.5.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
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
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,8 @@ | ||
apiVersion: monitoring.googleapis.com/v1 | ||
kind: OperatorConfig | ||
metadata: | ||
namespace: gmp-public | ||
name: config | ||
features: | ||
targetStatus: | ||
enabled: true |
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