Skip to content

Commit

Permalink
Remove WORKSPACE from s3 image path
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd authored and nutfdt committed May 23, 2024
1 parent 5095d4d commit d89ff1d
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 112 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/deploy.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ jobs:
container:
image: ghcr.io/datalab-mi/basegun/basegun-backend:${{ github.head_ref }}
env:
WORKSPACE: dev
AWS_REGION: gra
AWS_DEFAULT_REGION: gra
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ check-dc-config-%: check-prerequisites ## Check docker-compose syntax
${DC} config -q

build: check-dc-config-%
TAG=${TAG} ${DC} build
${DC} build

up: check-dc-config-%
ifeq ("$(WORKSPACE)","preprod")
TAG=${TAG} PORT_PROD=8080 ${DC} up -d
else
TAG=${TAG} ${DC} up -d
endif
${DC} up -d

down:
${DC} down
Expand Down
2 changes: 1 addition & 1 deletion backend/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_base_logs(user_agent, user_id: str) -> dict:
# Object storage
S3_URL_ENDPOINT = os.environ["S3_URL_ENDPOINT"]
S3_BUCKET_NAME = os.environ["S3_BUCKET_NAME"]
S3_PREFIX = os.path.join("uploaded-images/", os.environ["WORKSPACE"])
S3_PREFIX = os.path.join("uploaded-images/")

S3 = boto3.resource("s3", endpoint_url=S3_URL_ENDPOINT, verify=False)

Expand Down
4 changes: 1 addition & 3 deletions backend/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

def upload_image(content: bytes, image_key: str):
"""Uploads an image to s3 bucket
path uploaded-images/WORKSPACE/img_name
where WORKSPACE is dev, preprod or prod
path uploaded-images/img_name
Args:
content (bytes): file content
image_key (str): path we want to have
Expand Down
3 changes: 1 addition & 2 deletions backend/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def check_log_base(self, log):

def test_upload(self):
"""Checks that the file upload works properly"""
if os.environ["WORKSPACE"] == "dev":
create_bucket()
create_bucket()
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "revolver.jpg")

with open(path, "rb") as f:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ services:
- http_proxy
- https_proxy
- no_proxy
- WORKSPACE=dev
- REQUESTS_CA_BUNDLE=$CACERT_LOCATION
ports:
- 5000:5000
Expand Down

0 comments on commit d89ff1d

Please sign in to comment.