-
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.
* feat(client.py): adding fields Added auth_provider and auth_method to Client class. Added model validator. * feat(auth/providers.py): adding functions for handling authentication methods * build(docker-compose-dev.yml): adding services needed for testing * refactor(providers.py): refactoring github function with token method * fix(auth): simplified code * test(test_token.py): testing token --------- Co-authored-by: Shiny Brar (he/il) <[email protected]>
- Loading branch information
Showing
3 changed files
with
146 additions
and
6 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,114 @@ | ||
version: "3.9" | ||
|
||
services: | ||
traefik: | ||
image: traefik:v2.10 | ||
command: | ||
- "--configFile=/etc/traefik/traefik.yaml" | ||
ports: | ||
- "80:80" | ||
- "8080:8080" | ||
volumes: | ||
- "/var/run/docker.sock:/var/run/docker.sock" | ||
- "./traefik.yaml:/etc/traefik/traefik.yaml" | ||
- "./traefik_docker.yaml:/etc/traefik/traefik_docker.yaml" | ||
|
||
authentication: | ||
image: authentication:local | ||
command: ["/bin/bash", "-c", "python -m authentication.server"] | ||
expose: | ||
- 4000 | ||
environment: | ||
- DEBUG=1 | ||
- SANIC_HOSTNAME=0.0.0.0 | ||
- SANIC_PORT=4000 | ||
- SANIC_ACCESS_LOG=true | ||
- SANIC_AUTO_RELOAD=true | ||
- SANIC_DEBUG=true | ||
- SANIC_CORS_ORIGINS=* | ||
- SANIC_ACCESS_URL=https://github.com/login/oauth/access_token | ||
- SANIC_ORGANIZATIONS_URL=https://api.github.com/user/orgs | ||
- SANIC_TEAMS_URL=https://api.github.com/user/teams | ||
- SANIC_GITHUB_ORGS_ALLOWED=CHIMEFRB,test-organization-36 | ||
|
||
buckets: | ||
image: chimefrb/buckets:latest | ||
command: ["/bin/bash", "-c", "python -m buckets.server"] | ||
expose: | ||
- 8004 | ||
environment: | ||
- SANIC_HOSTNAME=0.0.0.0 | ||
- SANIC_PORT=8004 | ||
- SANIC_ACCESS_LOG=true | ||
- SANIC_AUTO_RELOAD=true | ||
- SANIC_DEBUG=true | ||
- SANIC_MONGODB_HOSTNAME=mongo | ||
- SANIC_MONGODB_PORT=27017 | ||
- SANIC_CORS_ORIGINS=* | ||
|
||
results: | ||
image: chimefrb/results:latest | ||
command: ["/bin/bash", "-c", "python -m results.server"] | ||
expose: | ||
- 8005 | ||
environment: | ||
- SANIC_HOSTNAME=0.0.0.0 | ||
- SANIC_PORT=8005 | ||
- SANIC_ACCESS_LOG=true | ||
- SANIC_AUTO_RELOAD=true | ||
- SANIC_DEBUG=true | ||
- SANIC_MONGODB_HOSTNAME=mongo | ||
- SANIC_MONGODB_PORT=27017 | ||
- SANIC_CORS_ORIGINS=* | ||
|
||
pipelines: | ||
image: chimefrb/pipelines:latest | ||
command: ["/bin/bash", "-c", "python -m pipelines.server"] | ||
expose: | ||
- 8006 | ||
environment: | ||
- SANIC_HOSTNAME=0.0.0.0 | ||
- SANIC_PORT=8006 | ||
- SANIC_ACCESS_LOG=true | ||
- SANIC_AUTO_RELOAD=true | ||
- SANIC_DEBUG=true | ||
- SANIC_MONGODB_HOSTNAME=mongo | ||
- SANIC_MONGODB_PORT=27017 | ||
- SANIC_CORS_ORIGINS=* | ||
- SANIC_START_MANAGER_URL=http://managers:8007/v1/start | ||
- SANIC_PAUSE_MANAGER_URL=http://managers:8007/v1/pause | ||
- SANIC_STOP_MANAGER_URL=http://managers:8007/v1/stop | ||
- SANIC_HEALTH_MANAGERS_URL=http://managers:8007/__health__ | ||
- SANIC_HEALTH_MANAGERS_CHECK_TIMES=10 | ||
- SANIC_HEALTH_MANAGERS_CHECK_INTERVAL_SECONDS=30 | ||
- SANIC_LISTENERS_THRESHOLD_SECONDS=120 | ||
|
||
managers: | ||
image: chimefrb/pipelines:latest | ||
command: ["/bin/bash", "-c", "python -m managers.server"] | ||
expose: | ||
- 8007 | ||
environment: | ||
- SANIC_HOSTNAME=0.0.0.0 | ||
- SANIC_PORT=8007 | ||
- SANIC_ACCESS_LOG=true | ||
- SANIC_AUTO_RELOAD=true | ||
- SANIC_DEBUG=true | ||
- SANIC_MONGODB_HOSTNAME=mongo | ||
- SANIC_MONGODB_PORT=27017 | ||
- SANIC_CORS_ORIGINS=* | ||
- SANIC_BUCKETS_URL=http://buckets:8004 | ||
- SANIC_RESULTS_URL=http://results:8005 | ||
- SANIC_UPDATE_INTERVAL_SECONDS=60 | ||
- SANIC_PURGE_TIME_SECONDS=3600 | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8007/__health__"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 5 | ||
|
||
mongo: | ||
image: mongo | ||
command: mongod --bind_ip_all | ||
ports: | ||
- "27017:27017" |
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,19 @@ | ||
"""Test the token passing.""" | ||
from workflow.definitions.work import Work | ||
from workflow.http.context import HTTPContext | ||
|
||
|
||
def test_work_pass_token_to_client(monkeypatch): | ||
"""Test that the Client objects can obtain token from Work object.""" | ||
test_token = "ghp_1234567890abcdefg" | ||
monkeypatch.setenv("WORKFLOW_HTTP_TOKEN", test_token) | ||
http = HTTPContext(timeout=10) | ||
work = Work(pipeline="test", site="local", user="test", http=http) | ||
|
||
# ? Check HTTPContext have token | ||
assert http.token.get_secret_value() == test_token # type: ignore | ||
|
||
# ? Check clients have token | ||
assert work.http.buckets.token.get_secret_value() == test_token # type: ignore | ||
assert work.http.results.token.get_secret_value() == test_token # type: ignore | ||
assert work.http.pipelines.token.get_secret_value() == test_token # type: ignore |
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