Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
feat: Update zip location for prebuilt samples with internal URL
Browse files Browse the repository at this point in the history
It avoids proxy/TLS/untrusted issue
related to eclipse-che/che#20709

Change-Id: Ic39fa9928c4f86ff4543117a9092f0cadb0457bd
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
  • Loading branch information
benoitf committed Dec 9, 2021
1 parent 138c556 commit 6b0f319
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .ci/generate_and_publish_registry_url_devfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions build/dev/publish-devfile-registry-to-surge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions build/dev/start-devfile-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions build/dockerfiles/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down Expand Up @@ -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%/}
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/generate_devworkspace_templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b0f319

Please sign in to comment.