Skip to content

Commit

Permalink
[2.8] Align gitlab resuable workflow with release-2.8 (#13034)
Browse files Browse the repository at this point in the history
* Align gitlab reusable workflow with release-2.8

* Bump extension creator 1.0.9
  • Loading branch information
jordojordo authored Jan 10, 2025
1 parent 3cb9e21 commit 2575899
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
2 changes: 1 addition & 1 deletion creators/extension/app/files/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ variables:
IMAGE_NAMESPACE: $CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME

include:
- remote: 'https://raw.githubusercontent.com/rancher/dashboard/master/shell/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml'
- remote: 'https://raw.githubusercontent.com/rancher/dashboard/release-2.8/shell/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml'
2 changes: 1 addition & 1 deletion creators/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rancher/create-extension",
"description": "Rancher UI Extension generator",
"version": "1.0.8",
"version": "1.0.9",
"license": "Apache-2.0",
"author": "SUSE",
"packageManager": "yarn@4.5.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
variables:
NODE_VERSION: "v16.20.2"
NODE_DISTRO: "node-${NODE_VERSION}-linux-x64"
YQ_VERSION: "v4.44.6"
YQ_URL: "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"

.podman-setup: &podman-setup
# Install podman and jq
- zypper --non-interactive install jq podman
- usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $(id -nu)
- podman login -u $REGISTRY_USER -p $REGISTRY_PASSWORD $REGISTRY

.node-setup: &node-setup
# Download, verify, and install Node.js, npm, and yarn
- curl -O https://nodejs.org/download/release/${NODE_VERSION}/${NODE_DISTRO}.tar.gz
- curl -O https://nodejs.org/download/release/${NODE_VERSION}/SHASUMS256.txt
- grep "${NODE_DISTRO}.tar.gz" SHASUMS256.txt | sha256sum -c -
- tar -xzf ${NODE_DISTRO}.tar.gz
- mv ${NODE_DISTRO} /usr/local/node
- ln -s /usr/local/node/bin/node /usr/local/bin/node
- ln -s /usr/local/node/bin/npm /usr/local/bin/npm
- npm install -g --unsafe-perm yarn
- export PATH="/usr/local/node/bin:/root/.npm-global/bin:$PATH"

check_version_collisions:
stage: check_version
rules:
- changes:
- package.json
script:
- *podman-setup
- |
PACKAGE_VERSION=`jq -r .version package.json`
PACKAGE_NAME=`jq -r .name package.json`
readarray -t VERSIONS < <(podman search $REGISTRY/$IMAGE_NAMESPACE/ui-extension-$PACKAGE_NAME --list-tags --format {{.Tag}})
echo -e "Checking for version collisions with Extension version: ${PACKAGE_VERSION}"
for version in ${VERSIONS[@]}; do
if [[ ${version} == ${PACKAGE_VERSION} ]]; then
echo "Cannot overwrite production image version ${version} since it already exists."
podman logout $REGISTRY
exit 1
fi
done
echo -e "Published image not found for version ${PACKAGE_VERSION}, continuing build..."
build_and_release:
stage: build_catalog
rules:
- changes:
- package.json
script:
- *podman-setup
- *node-setup
- zypper --non-interactive --no-gpg-checks refresh
- zypper --non-interactive install go git helm

# Download and install yq
- curl -sLf ${YQ_URL} -o /usr/bin/yq && chmod +x /usr/bin/yq

# Install dependencies and build extension catalog
- yarn
- yarn publish-pkgs -cl -r $REGISTRY -o $IMAGE_NAMESPACE

# Push all images except the base image
- podman push `podman images -f reference!=registry.suse.com/bci/bci-base --format "{{index .Names 0}}"`
- podman logout $REGISTRY

0 comments on commit 2575899

Please sign in to comment.