Skip to content

Commit

Permalink
Fix namespace logos on s3
Browse files Browse the repository at this point in the history
Issue: AAH-2575
  • Loading branch information
newswangerd committed Jul 20, 2023
1 parent 305b0a3 commit 8d63b91
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci_oci-env-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- TEST_PROFILE: insights
- TEST_PROFILE: iqe_rbac
- TEST_PROFILE: x_repo_search
- TEST_PROFILE: minio
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions CHANGES/2575.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where namespace logos would fail to download with S3 backends.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ gh-action/standalone:
gh-action/certified-sync:
python3 dev/oci_env_integration/actions/certified-sync.py

.PHONY: gh-action/minio
gh-action/minio:
python3 dev/oci_env_integration/actions/minio.py

.PHONY: docker/loaddata
docker/loaddata: ## Load initial data from python script
$(call exec_or_run, api, "/bin/bash", "-c", "/entrypoint.sh manage shell < app/dev/common/setup_test_data.py")
Expand Down
14 changes: 14 additions & 0 deletions dev/oci_env_integration/actions/minio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import action_lib

env = action_lib.OCIEnvIntegrationTest(
envs=[
{
"env_file": "minio.compose.env",
"run_tests": True,
"db_restore": None,

# the minio client can take a long time to download
"wait_before_tests": 120
}
]
)
19 changes: 19 additions & 0 deletions dev/oci_env_integration/oci_env_configs/minio.compose.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
COMPOSE_PROFILE=galaxy_ng/base:pminio
COMPOSE_PROJECT_NAME=ci-standalone

DEV_SOURCE_PATH=galaxy_ng
COMPOSE_BINARY=docker
SETUP_TEST_DATA=1
UPDATE_UI=0
ENABLE_SIGNING=1

DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_PASSWORD=admin

PULP_GALAXY_API_PATH_PREFIX=/api/galaxy/

API_PORT=53001

S3_ENDPOINT_URL=http://localhost:81651
MINIO_CONSOLE_PORT=7812
MINIO_PORT=11651
9 changes: 6 additions & 3 deletions galaxy_ng/app/tasks/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ def _download_avatar(url):
print("file is not an image")
return

return Artifact.init_and_validate(tf)
# the artifact has to be saved before the file is closed, or s3transfer
# will throw an error.
artifact = Artifact.init_and_validate(tf)
artifact.save()

return artifact


def _create_pulp_namespace(galaxy_ns_pk, download_logo):
Expand Down Expand Up @@ -99,8 +104,6 @@ def _create_pulp_namespace(galaxy_ns_pk, download_logo):
else:
with transaction.atomic():
metadata.save()
if avatar_artifact:
avatar_artifact.save()
ContentArtifact.objects.create(
artifact=avatar_artifact,
content=metadata,
Expand Down

0 comments on commit 8d63b91

Please sign in to comment.