From 26568af027f6f6d57366f779111b396d53589f24 Mon Sep 17 00:00:00 2001 From: alexlianides <114772744+alexlianides@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:13:10 -0700 Subject: [PATCH] implemented pull_config_yamls and updated updated test-devcontainer feature to test feature (#113) Co-authored-by: alexlianides --- .devcontainer/artifacts.yaml | 19 ++++++++++++ .../spacefx-dev/devcontainer-feature.json | 2 +- .../features/spacefx-dev/updateContent.sh | 29 +++++++++++++++++++ .devcontainer/test-feature/devcontainer.json | 5 ++-- tests/dev_cluster.sh | 7 +++++ 5 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/artifacts.yaml diff --git a/.devcontainer/artifacts.yaml b/.devcontainer/artifacts.yaml new file mode 100644 index 0000000..1d5ae76 --- /dev/null +++ b/.devcontainer/artifacts.yaml @@ -0,0 +1,19 @@ +config: + containerRegistries: + - url: ghcr.io + repositoryPrefix: microsoft/azure-orbital-space-sdk + push_enabled: true + pull_enabled: true + login_enabled: false + login_username_file: ${HOME}/.ssh/ghcr_username + login_password_file: ${HOME}/.ssh/ghcr_password + - url: testdoesnotexist.azurecr.io + push_enabled: false + pull_enabled: true + login_enabled: false + extraBuildArtifacts: + - file: testartifact.txt + directory: tmp/test + repository: test + tag: 0.11.0 + \ No newline at end of file diff --git a/.devcontainer/features/spacefx-dev/devcontainer-feature.json b/.devcontainer/features/spacefx-dev/devcontainer-feature.json index 25cba1c..4e1d70b 100644 --- a/.devcontainer/features/spacefx-dev/devcontainer-feature.json +++ b/.devcontainer/features/spacefx-dev/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Microsoft Azure Orbital Space SDK - DevContainer Feature", "id": "spacefx-dev", - "version": "0.10.0", + "version": "0.11.0", "description": "Deploys the environmental configuration used for developing payload application and plugins within the Azure Orbital Framework", "documentationURL": "https://github.com/microsoft/azure-orbital-space-sdk-setup", "options": { diff --git a/.devcontainer/features/spacefx-dev/updateContent.sh b/.devcontainer/features/spacefx-dev/updateContent.sh index 25d54f2..2c8d821 100755 --- a/.devcontainer/features/spacefx-dev/updateContent.sh +++ b/.devcontainer/features/spacefx-dev/updateContent.sh @@ -74,7 +74,36 @@ function pull_config_yamls(){ info_log "START: ${FUNCNAME[0]}" + if [[ ${#ADDL_CONFIG_YAMLS[@]} -eq 0 ]]; then + info_log "...no additional yamls specified in devcontainer.json. Nothing to do" + info_log "END: ${FUNCNAME[0]}" + return + fi + + for config_yaml in "${ADDL_CONFIG_YAMLS[@]}"; do + if [[ -z "${config_yaml}" ]]; then + continue + fi + + # debug_log "Container Working Dir: ${CONTAINER_WORKING_DIR}" + # debug_log "Host Folder: ${HOST_FOLDER}" + # config_yaml=${config_yaml//$CONTAINER_WORKING_DIR/$HOST_FOLDER} + info_log "checking for ${config_yaml}" + + if [[ ! -f "${config_yaml}" ]]; then + exit_with_error "Unable to find config yaml '${config_yaml}'. Please check your path and rebuild devcontainer. Path must be from devcontainer's perspective" + fi + + info_log "...adding config yaml'${config_yaml}' to ${SPACEFX_DIR}/config..." + + run_a_script "basename ${config_yaml}" config_yaml_filename + + info_log "Copying '${config_yaml}' to '${SPACEFX_DIR}/config/${config_yaml_filename}'..." + run_a_script "cp ${config_yaml} ${SPACEFX_DIR}/config/${config_yaml_filename}" + info_log "...successfully copied '${config_yaml}' to '${SPACEFX_DIR}/config/${config_yaml_filename}'" + + done info_log "END: ${FUNCNAME[0]}" diff --git a/.devcontainer/test-feature/devcontainer.json b/.devcontainer/test-feature/devcontainer.json index bd52e06..c2638e7 100644 --- a/.devcontainer/test-feature/devcontainer.json +++ b/.devcontainer/test-feature/devcontainer.json @@ -10,7 +10,8 @@ "ghcr.io/microsoft/azure-orbital-space-sdk/spacefx-dev:0.11.0_test_do_not_use-nightly": { "app_name": "spacesdk-setup", "app_type": "none", - "extract_setup_files": "false" + "extract_setup_files": "false", + "addl_config_yamls":"/workspaces/azure-orbital-space-sdk-setup/.devcontainer/artifacts.yaml" } }, "hostRequirements": { @@ -104,5 +105,5 @@ } }, "remoteUser": "root", - "initializeCommand": "${localWorkspaceFolder}/.vscode/copy_to_spacedev.sh --output-dir ${localWorkspaceFolder}/.devcontainer/features/spacefx-dev/azure-orbital-space-sdk-setup" + "initializeCommand": "bash ${localWorkspaceFolder}/.vscode/copy_to_spacedev.sh --output-dir ${localWorkspaceFolder}/.devcontainer/features/spacefx-dev/azure-orbital-space-sdk-setup ; bash ${localWorkspaceFolder}/.vscode/copy_to_spacedev.sh" } diff --git a/tests/dev_cluster.sh b/tests/dev_cluster.sh index 14f2ce9..8343ada 100755 --- a/tests/dev_cluster.sh +++ b/tests/dev_cluster.sh @@ -169,6 +169,13 @@ wait_for_namespace_to_provision --namespace coresvc wait_for_namespace_to_provision --namespace hostsvc wait_for_namespace_to_provision --namespace platformsvc +echo "Checking for artifacts.yaml in /var/spacedev/config..." +artifact_yaml="/var/spacedev/config/artifacts.yaml" +if [[ ! -f "${artifact_yaml}" ]]; then + echo "artifacts.yaml not found in /var/spacedev/config. Please ensure the file is present." + exit 1 +fi + echo "" echo "" echo ""