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

feat: Update zip location for prebuilt samples with internal URL #544

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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