diff --git a/.ci/generate_and_publish_registry_url_devfiles.sh b/.ci/generate_and_publish_registry_url_devfiles.sh index 2629fbfc1..8a04ae337 100755 --- a/.ci/generate_and_publish_registry_url_devfiles.sh +++ b/.ci/generate_and_publish_registry_url_devfiles.sh @@ -63,8 +63,10 @@ ${BUILDER} cp devfileRegistry:/var/www/html/README.md /tmp/content/"${VERSION}" # Run entrypoint CHE_DEVFILE_REGISTRY_URL="https://eclipse-che.github.io/che-devfile-registry/${VERSION}" +CHE_DEVFILE_REGISTRY_INTERNAL_URL="https://eclipse-che.github.io/che-devfile-registry/${VERSION}" DEVFILES_DIR=/tmp/content/"${VERSION}"/devfiles export CHE_DEVFILE_REGISTRY_URL +export CHE_DEVFILE_REGISTRY_INTERNAL_URL export DEVFILES_DIR ./build/dockerfiles/entrypoint.sh diff --git a/build/dev/publish-devfile-registry-to-surge.sh b/build/dev/publish-devfile-registry-to-surge.sh index 5964a6d3a..a3b5c29ff 100755 --- a/build/dev/publish-devfile-registry-to-surge.sh +++ b/build/dev/publish-devfile-registry-to-surge.sh @@ -28,9 +28,11 @@ cp -rf "$BUILD_DIR/devfiles" "$SURGE_DIR/devfiles" cp -rf "$IMAGES_SRC"/* "$SURGE_DIR/images" CHE_DEVFILE_REGISTRY_URL="https://$CHE_WORKSPACE_NAMESPACE-$CHE_WORKSPACE_NAME.surge.sh" +CHE_DEVFILE_REGISTRY_INTERNAL_URL="https://$CHE_WORKSPACE_NAMESPACE-$CHE_WORKSPACE_NAME.surge.sh" DEVFILES_DIR=${SURGE_DIR}/devfiles export CHE_DEVFILE_REGISTRY_URL +export CHE_DEVFILE_REGISTRY_INTERNAL_URL export DEVFILES_DIR "$REPO_DIR/build/dockerfiles/entrypoint.sh" echo "done running entrypoint.sh to publish to surge" diff --git a/build/dev/start-devfile-registry.sh b/build/dev/start-devfile-registry.sh index 0f1a6d405..2a1a5ac7f 100755 --- a/build/dev/start-devfile-registry.sh +++ b/build/dev/start-devfile-registry.sh @@ -24,7 +24,9 @@ rm -rf /usr/local/apache2/htdocs/images/* cp -rf "$BUILD_DIR"/devfiles /usr/local/apache2/htdocs/devfiles cp -rf "$IMAGES_SRC"/* /usr/local/apache2/htdocs/images CHE_DEVFILE_REGISTRY_URL=$(cat "$BUILD_DIR"/ENV_CHE_DEVFILE_REGISTRY_URL) +CHE_DEVFILE_REGISTRY_INTERNAL_URL="${CHE_DEVFILE_REGISTRY_URL}" export CHE_DEVFILE_REGISTRY_URL +export CHE_DEVFILE_REGISTRY_INTERNAL_URL echo "$CHE_DEVFILE_REGISTRY_URL" /projects/che-devfile-registry/build/dockerfiles/entrypoint.sh echo "Starting Apache ..." httpd-foreground diff --git a/build/dockerfiles/entrypoint.sh b/build/dockerfiles/entrypoint.sh index 2f0ee951d..9d5a7b485 100755 --- a/build/dockerfiles/entrypoint.sh +++ b/build/dockerfiles/entrypoint.sh @@ -30,6 +30,7 @@ REGISTRY=${CHE_DEVFILE_IMAGES_REGISTRY_URL} ORGANIZATION=${CHE_DEVFILE_IMAGES_REGISTRY_ORGANIZATION} TAG=${CHE_DEVFILE_IMAGES_REGISTRY_TAG} PUBLIC_URL=${CHE_DEVFILE_REGISTRY_URL} +INTERNAL_URL=${CHE_DEVFILE_REGISTRY_INTERNAL_URL} DEFAULT_DEVFILES_DIR="/var/www/html/devfiles" DEVFILES_DIR="${DEVFILES_DIR:-${DEFAULT_DEVFILES_DIR}}" @@ -135,6 +136,12 @@ for devfile in "${devfiles[@]}"; do fi done +if [ -n "$INTERNAL_URL" ]; then + INTERNAL_URL=${INTERNAL_URL%/} + echo "Updating internal URL in files to ${INTERNAL_URL}" + sed -i "s|{{ INTERNAL_URL }}|${INTERNAL_URL}|" "${devfiles[@]}" "${metas[@]}" "${templates[@]}" "$INDEX_JSON" +fi + if [ -n "$PUBLIC_URL" ]; then echo "Updating devfiles to point at internal project zip files" PUBLIC_URL=${PUBLIC_URL%/} diff --git a/build/scripts/generate_devworkspace_templates.sh b/build/scripts/generate_devworkspace_templates.sh index 27959e51e..316ff41de 100755 --- a/build/scripts/generate_devworkspace_templates.sh +++ b/build/scripts/generate_devworkspace_templates.sh @@ -26,12 +26,12 @@ do npm_config_yes=true npx @eclipse-che/che-theia-devworkspace-handler --devfile-url:"${devfile_url}" \ --output-file:"${dir}"/devworkspace-che-theia-next.yaml \ - --project."${name}={{ DEVFILE_REGISTRY_URL }}/resources/v2/${name}.zip" + --project."${name}={{ INTERNAL_URL }}/resources/v2/${name}.zip" npm_config_yes=true npx @eclipse-che/che-theia-devworkspace-handler --devfile-url:"${devfile_url}" \ --editor:eclipse/che-theia/latest \ --output-file:"${dir}"/devworkspace-che-theia-latest.yaml \ - --project."${name}={{ DEVFILE_REGISTRY_URL }}/resources/v2/${name}.zip" + --project."${name}={{ INTERNAL_URL }}/resources/v2/${name}.zip" clone_and_zip "${devfile_repo}" "${devfile_url##*/}" "/build/resources/v2/$name.zip" fi