Skip to content

token passthrough + bugfix #468

token passthrough + bugfix

token passthrough + bugfix #468

Triggered via push February 16, 2024 18:48
Status Failure
Total duration 31s
Artifacts

cicd.yml

on: push
gitflow-enforcer
0s
gitflow-enforcer
Run linters
8s
Run linters
deploy-to-dev  /  deploy
deploy-to-dev / deploy
deploy-to-production  /  deploy
deploy-to-production / deploy
deploy-to-staging  /  deploy
deploy-to-staging / deploy
Fit to window
Zoom out
Zoom in

Annotations

17 errors and 2 warnings
workflows_api/runtime/src/collection_publisher.py#L1
'os' imported but unused (F401)
workflows_api/runtime/src/collection_publisher.py#L2
'typing.Optional' imported but unused (F401)
workflows_api/runtime/src/schemas.py#L21
'src.services' imported but unused (F401)
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/config.py#L19
ingest_url: str = Field(description="URL of ingest API") raster_url: str = Field(description="URL of raster API") stac_url: str = Field(description="URL of STAC API") mwaa_env: str = Field(description="MWAA URL") - class Config(): + class Config: env_file = ".env"
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/auth.py#L63
def get_username(claims: security.HTTPBasicCredentials = Depends(decode_token)): return claims["sub"] -def get_and_validate_token(token: security.HTTPAuthorizationCredentials = Depends(token_scheme)): + +def get_and_validate_token( + token: security.HTTPAuthorizationCredentials = Depends(token_scheme), +): decode_token(token) return token + def _get_secret_hash(username: str, client_id: str, client_secret: str) -> str: # A keyed-hash message authentication code (HMAC) calculated using # the secret key of a user pool client and username plus the client # ID in the message.
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/main.py#L62
@workflows_app.post( "/dataset/publish", tags=["Dataset"], dependencies=[Depends(auth.get_username)] ) async def publish_dataset( - token = Depends(auth.get_and_validate_token), + token=Depends(auth.get_and_validate_token), dataset: Union[schemas.ZarrDataset, schemas.COGDataset] = Body( ..., discriminator="data_type" ), ): # Construct and load collection
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/collection_publisher.py#L25
collection = collection.model_dump(by_alias=True) url = f"{ingest_api}/collections" headers = { "Authorization": f"Bearer {token}", - "Content-Type": "application/json" + "Content-Type": "application/json", } response = requests.post(url, json=collection, headers=headers) if response.status_code == 200: print("Success:", response.json()) else: print("Error:", response.status_code, response.text) + # TODO refactor class Publisher: common_fields = [ "title",
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/collection_publisher.py#L164
collection = collection.model_dump(by_alias=True) url = f"{ingest_api}/collections" headers = { "Authorization": f"Bearer {token}", - "Content-Type": "application/json" + "Content-Type": "application/json", } response = requests.post(url, json=collection, headers=headers) if response.status_code == 200: print("Success:", response.json()) else: print("Error:", response.status_code, response.text) -
Run linters
Linting failures detected. See check runs with annotations for details.
workflows_api/runtime/src/collection_publisher.py#L1
'os' imported but unused (F401)
workflows_api/runtime/src/collection_publisher.py#L2
'typing.Optional' imported but unused (F401)
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/config.py#L19
ingest_url: str = Field(description="URL of ingest API") raster_url: str = Field(description="URL of raster API") stac_url: str = Field(description="URL of STAC API") mwaa_env: str = Field(description="MWAA URL") - class Config(): + class Config: env_file = ".env"
workflows_api/runtime/src/schemas.py#L21
'src.services' imported but unused (F401)
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/auth.py#L63
def get_username(claims: security.HTTPBasicCredentials = Depends(decode_token)): return claims["sub"] -def get_and_validate_token(token: security.HTTPAuthorizationCredentials = Depends(token_scheme)): + +def get_and_validate_token( + token: security.HTTPAuthorizationCredentials = Depends(token_scheme), +): decode_token(token) return token + def _get_secret_hash(username: str, client_id: str, client_secret: str) -> str: # A keyed-hash message authentication code (HMAC) calculated using # the secret key of a user pool client and username plus the client # ID in the message.
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/main.py#L62
@workflows_app.post( "/dataset/publish", tags=["Dataset"], dependencies=[Depends(auth.get_username)] ) async def publish_dataset( - token = Depends(auth.get_and_validate_token), + token=Depends(auth.get_and_validate_token), dataset: Union[schemas.ZarrDataset, schemas.COGDataset] = Body( ..., discriminator="data_type" ), ): # Construct and load collection
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/collection_publisher.py#L25
collection = collection.model_dump(by_alias=True) url = f"{ingest_api}/collections" headers = { "Authorization": f"Bearer {token}", - "Content-Type": "application/json" + "Content-Type": "application/json", } response = requests.post(url, json=collection, headers=headers) if response.status_code == 200: print("Success:", response.json()) else: print("Error:", response.status_code, response.text) + # TODO refactor class Publisher: common_fields = [ "title",
/home/runner/work/veda-data-airflow/veda-data-airflow/workflows_api/runtime/src/collection_publisher.py#L164
collection = collection.model_dump(by_alias=True) url = f"{ingest_api}/collections" headers = { "Authorization": f"Bearer {token}", - "Content-Type": "application/json" + "Content-Type": "application/json", } response = requests.post(url, json=collection, headers=headers) if response.status_code == 200: print("Success:", response.json()) else: print("Error:", response.status_code, response.text) -
Run linters
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions/setup-python@v4, wearerequired/lint-action@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
Run linters
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/