Skip to content

Commit

Permalink
stage wheels into coresvc-registry (#88)
Browse files Browse the repository at this point in the history
* adds pyi helper scripts that will later be moved to documentation

* stage the spacefx wheel into coresvc-registry's pypi server

* removes pypiserver directory

* move the wheels instead of copying them

* adds wheel/.gitkeep

---------

Co-authored-by: Brad Armstrong <[email protected]>
  • Loading branch information
bradarm and Brad Armstrong authored Jul 26, 2024
1 parent a1aeab0 commit d9b5b52
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .vscode/copy_to_spacedev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function main() {
copy_directory_to_dest --directory "env"
copy_directory_to_dest --directory "modules"
copy_directory_to_dest --directory "protos"
copy_directory_to_dest --directory "pypiserver"
copy_directory_to_dest --directory "wheel"
copy_directory_to_dest --directory "scripts"

while read -r shellFile; do
Expand Down
8 changes: 4 additions & 4 deletions chart/templates/coresvc_registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ spec:
mountPath: /var/lib/registry
- name: registry-cert-mount
mountPath: /certs
- name: pypiserver-data-mount
mountPath: /data
- name: pypiserver-packages-mount
mountPath: /data/packages
volumes:
- name: pypiserver-data-mount
- name: pypiserver-packages-mount
hostPath:
path: {{ $globalValues.spacefxDirectories.base }}/registry/pypiserver
path: {{ $globalValues.spacefxDirectories.base }}/registry/pypiserver/packages
type: DirectoryOrCreate
- name: registry-data-mount
hostPath:
Expand Down
68 changes: 0 additions & 68 deletions pypiserver/scripts/stage_python_packages.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/coresvc_registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function start_registry_docker(){
-v ${SPACEFX_DIR}/registry/data:/var/lib/registry \
-v ${SPACEFX_DIR}/certs/registry:/certs \
-v ${SPACEFX_DIR}/certs/ca/ca.spacefx.local.pem:/etc/pki/ca-trust/source/anchors/ca.spacefx.local.pem:ro \
-v ${SPACEFX_DIR}/pypiserver:/data \
-v ${SPACEFX_DIR}/registry/pypiserver/packages:/data/packages \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.spacefx.local.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.spacefx.local.key \
--name=${REGISTRY_REPO} ${coresvc_registry_parent}/${_repo_name}:${spacefx_version_tag}"
Expand Down
31 changes: 13 additions & 18 deletions scripts/stage_spacefx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -506,21 +506,17 @@ function stage_build_artifacts(){
function stage_python_wheels(){
info_log "START: ${FUNCNAME[0]}"

if [[ ! -f "${SPACEFX_DIR}/pypiserver/requirements.txt" ]]; then
info_log "...no requirements file found at '${SPACEFX_DIR}/pypiserver/requirements.txt'. Nothing to do."
info_log "END: ${FUNCNAME[0]}"
return
fi
# Stage the microsoft-azure-orbital-sdk wheel to the wheel directory
run_a_script "${SPACEFX_DIR}/scripts/stage/stage_build_artifact.sh --architecture ${ARCHITECTURE} --artifact microsoftazurespacefx-${SPACEFX_VERSION}-py3-none-any.whl"

if [[ ! -s "${SPACEFX_DIR}/pypiserver/requirements.txt" ]]; then
info_log "...the requirements file '${SPACEFX_DIR}/pypiserver/requirements.txt' is empty. Nothing to do. Nothing to do."
info_log "END: ${FUNCNAME[0]}"
return
fi
# Find all wheels in the ${SPACEFX_DIR}/wheel directory and move them to the ${SPACEFX_DIR}/registry/pypiserver/packages directory
# Move only the wheel itself to the root level of the ${SPACEFX_DIR}/registry/pypiserver/packages directory and not the entire directory structure
# The pypiserver will detect these wheels and serve the python packages when it boots up
run_a_script "mkdir -p ${SPACEFX_DIR}/registry/pypiserver/packages"
run_a_script "find ${SPACEFX_DIR}/wheel -type f -name '*.whl' -exec mv {} ${SPACEFX_DIR}/registry/pypiserver/packages \;"

info_log "Staging python wheels..."
run_a_script "docker exec coresvc-registry /data/scripts/stage_python_packages.sh"
info_log "...successfully staged python wheels."
# Remove the wheel directory
run_a_script "rm -rf ${SPACEFX_DIR}/wheel"

info_log "FINISHED: ${FUNCNAME[0]}"
}
Expand Down Expand Up @@ -594,6 +590,10 @@ function main() {
enable_fileserver
_generate_spacefx_config_json

info_log "Staging python wheels..."
stage_python_wheels
info_log "...successfully staged python wheels"

info_log "Staging coresvc-registry..."
stage_coresvc_registry
info_log "...successfully staged coresvc-registry"
Expand Down Expand Up @@ -626,13 +626,8 @@ function main() {
stage_spacefx_service_images --service_group host
info_log "...service images successfully staged."


stage_python_wheels


remove_channels_from_extra_containers


info_log "Stopping coresvc-registry..."
run_a_script "${SPACEFX_DIR}/scripts/coresvc_registry.sh --stop"
info_log "...successfully stopped coresvc-registry"
Expand Down
File renamed without changes.

0 comments on commit d9b5b52

Please sign in to comment.