Skip to content

Commit

Permalink
test: run with multiple container runtime Docker versions
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Aug 29, 2024
1 parent 00a5e3f commit a1f0a53
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/helm-chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,44 @@ jobs:
test-strategy: disabled
cluster: 'minikube'
helm-version: 'v3.10.3'
docker-version: '20.10.24'
test-upgrade: true
- k8s-version: 'v1.26.15'
test-strategy: job
cluster: 'minikube'
helm-version: 'v3.11.3'
docker-version: '23.0.6'
test-upgrade: true
- k8s-version: 'v1.27.16'
test-strategy: deployment
cluster: 'minikube'
helm-version: 'v3.12.3'
docker-version: '24.0.9'
test-upgrade: true
- k8s-version: 'v1.28.13'
test-strategy: job_https
cluster: 'minikube'
helm-version: 'v3.13.3'
docker-version: '25.0.5'
test-upgrade: true
- k8s-version: 'v1.29.8'
test-strategy: job_hostname
cluster: 'minikube'
helm-version: 'v3.14.4'
docker-version: '26.1.4'
test-upgrade: true
- k8s-version: 'v1.30.4'
test-strategy: deployment_https
cluster: 'minikube'
helm-version: 'v3.15.4'
docker-version: '27.2.0'
test-upgrade: true
env:
CLUSTER: ${{ matrix.cluster }}
KUBERNETES_VERSION: ${{ matrix.k8s-version }}
ARTIFACT_NAME: "${{ matrix.k8s-version }}-${{ matrix.test-strategy }}"
HELM_VERSION: ${{ matrix.helm-version }}
DOCKER_VERSION: ${{ matrix.docker-version }}
TEST_UPGRADE_CHART: ${{ matrix.test-upgrade }}
steps:
- name: Free Disk Space (Ubuntu)
Expand Down
2 changes: 2 additions & 0 deletions generate_chart_changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ generate_changelog() {
# Get the changes for each section (Added, Removed, Fixed, Changed)
image_tag_changes=$(echo "Chart is using image tag $CHART_APP_VERSION" | sed -e 's/^/- /')
k8s_versions_tested=$(echo "Chart is tested on Kubernetes versions: $(cat .github/workflows/helm-chart-test.yml | grep -oP "k8s-version: '\Kv.*(?=')" | tr '\n' ',' | sed s/,/,\ /g)" | sed -e 's/^/- /')
docker_versions_tested=$(echo "Chart is tested on container runtime Docker versions: $(cat .github/workflows/helm-chart-test.yml | grep -oP "docker-version: '\Kv.*(?=')" | tr '\n' ',' | sed s/,/,\ /g)" | sed -e 's/^/- /')
helm_versions_tested=$(echo "Chart is tested on Helm versions: $(cat .github/workflows/helm-chart-test.yml | grep -oP "helm-version: '\Kv.*(?=')" | tr '\n' ',' | sed s/,/,\ /g)" | sed -e 's/^/- /')
added_changes=$(git log --pretty=format:"[\`%h\`](http://github.com/seleniumhq/docker-selenium/commit/%H) - %s :: %an" "$commit_range" -- "$CHART_DIR" | grep -iE "\- feat|\- add" | sed -e 's/^/- /')
removed_changes=$(git log --pretty=format:"[\`%h\`](http://github.com/seleniumhq/docker-selenium/commit/%H) - %s :: %an" "$commit_range" -- "$CHART_DIR" | grep -iE "\- remove|\- deprecate|\- delete" | sed -e 's/^/- /')
Expand All @@ -53,6 +54,7 @@ generate_changelog() {
echo "" >> "$temp_file"
echo "$image_tag_changes" >> "$temp_file"
echo "$k8s_versions_tested" >> "$temp_file"
echo "$docker_versions_tested" >> "$temp_file"
echo "$helm_versions_tested" >> "$temp_file"
echo "" >> "$temp_file"

Expand Down
15 changes: 12 additions & 3 deletions generate_release_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ BUILD_DATE=$4
NAMESPACE=${NAME:-selenium}
FFMPEG_TAG_VERSION=$(grep FFMPEG_TAG_VERSION Makefile | sed 's/.*,\([^)]*\))/\1/p' | head -n 1)
RCLONE_TAG_VERSION=$(grep RCLONE_TAG_VERSION Makefile | sed 's/.*,\([^)]*\))/\1/p' | head -n 1)
AUTHORS=${AUTHORS:-"SeleniumHQ"}

TAG_VERSION=${GRID_VERSION}-${BUILD_DATE}

echo "" >> release_notes.md
echo "### Changelog" > release_notes.md
git --no-pager log "${LATEST_TAG}...${HEAD_BRANCH}" --pretty=format:"* [\`%h\`](http://github.com/seleniumhq/docker-selenium/commit/%H) - %s :: %an" --reverse >> release_notes.md

GRID_REVISION=$(docker run --entrypoint="" --rm ${NAMESPACE}/base:${TAG_VERSION} java -jar /opt/selenium/selenium-server.jar info --version | awk '{print $5}')
CHROME_VERSION=$(docker run --rm ${NAMESPACE}/node-chrome:${TAG_VERSION} google-chrome --version | awk '{print $3}')
EDGE_VERSION=$(docker run --rm ${NAMESPACE}/node-edge:${TAG_VERSION} microsoft-edge --version | awk '{print $3}')
CHROMEDRIVER_VERSION=$(docker run --rm ${NAMESPACE}/node-chrome:${TAG_VERSION} chromedriver --version | awk '{print $2}')
Expand All @@ -23,16 +25,22 @@ GECKODRIVER_VERSION=$(docker run --rm ${NAMESPACE}/node-firefox:${TAG_VERSION} g
FFMPEG_VERSION=$(docker run --entrypoint="" --rm ${NAMESPACE}/video:${FFMPEG_TAG_VERSION}-${BUILD_DATE} ffmpeg -version | awk '{print $3}' | head -n 1)
RCLONE_VERSION=$(docker run --entrypoint="" --rm ${NAMESPACE}/video:${FFMPEG_TAG_VERSION}-${BUILD_DATE} rclone version | head -n 1 | awk '{print $2}' | tr -d 'v')
JRE_VERSION=$(docker run --entrypoint="" --rm ${NAMESPACE}/base:${TAG_VERSION} java --version | grep -oP '\b\d+\.\d+\.\d+\b' | head -1)
OS_VERSION=$(docker run --entrypoint="" --rm ${NAMESPACE}/base:${TAG_VERSION} cat /etc/os-release | grep PRETTY_NAME | cut -d '"' -f 2)
FIREFOX_ARM64_VERSION=$(docker run --rm --platform linux/arm64 ${NAMESPACE}/node-firefox:${TAG_VERSION} firefox --version | awk '{print $3}')
CHROMIUM_VERSION=$(docker run --rm ${NAMESPACE}/node-chromium:${TAG_VERSION} chromium --version | awk '{print $2}')
CHROMIUMDRIVER_VERSION=$(docker run --rm ${NAMESPACE}/node-chromium:${TAG_VERSION} chromedriver --version | awk '{print $2}')

if [[ "${GRID_VERSION}" == *"SNAPSHOT"* ]]; then
GRID_RELEASE_TAG="nightly"
else
GRID_RELEASE_TAG="selenium-${GRID_VERSION}"
fi
LINK_GRID_DETAILS="[${GRID_VERSION}](https://github.com/${AUTHORS}/selenium/releases/tag/${GRID_RELEASE_TAG}) (rev [${GRID_REVISION}](https://github.com/${AUTHORS}/selenium/commit/${GRID_REVISION}))"

echo "" >> release_notes.md
echo "### Released versions" >> release_notes.md
echo "| Components | x86_64 (amd64) | aarch64 (arm64/armv8) |" >> release_notes.md
echo "|:----------:|:--------------:|:---------------------:|" >> release_notes.md
echo "| Selenium | ${GRID_VERSION} | ${GRID_VERSION} |" >> release_notes.md
echo "| Selenium Grid | ${LINK_GRID_DETAILS} | ${LINK_GRID_DETAILS} |" >> release_notes.md
echo "| Chromium | ${CHROMIUM_VERSION} | ${CHROMIUM_VERSION} |" >> release_notes.md
echo "| Chrome | ${CHROME_VERSION} | x |" >> release_notes.md
echo "| ChromeDriver | ${CHROMEDRIVER_VERSION} | ${CHROMIUMDRIVER_VERSION} |" >> release_notes.md
Expand All @@ -43,6 +51,7 @@ echo "| GeckoDriver | ${GECKODRIVER_VERSION} | ${GECKODRIVER_VERSION} |" >> rele
echo "| ffmpeg | ${FFMPEG_VERSION} | ${FFMPEG_VERSION} |" >> release_notes.md
echo "| rclone | ${RCLONE_VERSION} | ${RCLONE_VERSION} |" >> release_notes.md
echo "| Java Runtime | ${JRE_VERSION} | ${JRE_VERSION} |" >> release_notes.md
echo "| OS | ${OS_VERSION} | ${OS_VERSION} |" >> release_notes.md

echo "" >> release_notes.md
echo "### Published Docker images on [Docker Hub](https://hub.docker.com/u/${NAMESPACE})" >> release_notes.md
Expand All @@ -57,4 +66,4 @@ echo "</details>" >> release_notes.md

echo "" >> release_notes.md
chart_version=$(find . \( -type d -name .git -prune \) -o -type f -wholename '*/selenium-grid/Chart.yaml' -print0 | xargs -0 cat | grep ^version | cut -d ':' -f 2 | tr -d '[:space:]')
echo "### Published Helm chart version [selenium-grid-${chart_version}](https://github.com/${AUTHORS:-"SeleniumHQ"}/docker-selenium/releases/tag/selenium-grid-${chart_version})" >> release_notes.md
echo "### Published Helm chart version [selenium-grid-${chart_version}](https://github.com/${AUTHORS}/docker-selenium/releases/tag/selenium-grid-${chart_version})" >> release_notes.md
18 changes: 15 additions & 3 deletions tests/charts/make/chart_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

echo "Set ENV variables"
CLUSTER=${CLUSTER:-"minikube"}
DOCKER_VERSION=${DOCKER_VERSION:-""}
HELM_VERSION=${HELM_VERSION:-"latest"}
KUBERNETES_VERSION=${KUBERNETES_VERSION:-$(curl -L -s https://dl.k8s.io/release/stable.txt)}

# Function to be executed on command failure
on_failure() {
Expand All @@ -24,7 +27,17 @@ echo \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -qq || true
sudo apt-get install -yq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin gcc-aarch64-linux-gnu qemu-user-static
if [ -n "${DOCKER_VERSION}" ]; then
if [[ "${DOCKER_VERSION}" == "20.10"* ]]; then
DOCKER_VERSION="=5:${DOCKER_VERSION}~3-0~$(. /etc/os-release; echo "$ID")-$(. /etc/os-release; echo "$VERSION_CODENAME")"
else
DOCKER_VERSION="=5:${DOCKER_VERSION}-1~$(. /etc/os-release; echo "$ID").$(. /etc/os-release; echo "$VERSION_ID")~$(. /etc/os-release; echo "$VERSION_CODENAME")"
fi
echo "Installing package docker-ce${DOCKER_VERSION}"
ALLOW_DOWNGRADE="--allow-downgrades"
fi
sudo apt-get install -yq ${ALLOW_DOWNGRADE} docker-ce${DOCKER_VERSION} docker-ce-cli${DOCKER_VERSION}
sudo apt-get install -yq ${ALLOW_DOWNGRADE} containerd.io docker-buildx-plugin docker-compose-plugin gcc-aarch64-linux-gnu qemu-user-static
sudo chmod 666 /var/run/docker.sock
docker version
docker buildx version
Expand Down Expand Up @@ -110,7 +123,7 @@ elif [ "${CLUSTER}" = "minikube" ]; then
fi

echo "Installing kubectl for AMD64 / ARM64"
curl -fsSL -o ./kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/$(dpkg --print-architecture)/kubectl"
curl -fsSL -o ./kubectl "https://dl.k8s.io/release/${KUBERNETES_VERSION}/bin/linux/$(dpkg --print-architecture)/kubectl"
chmod +x ./kubectl
sudo cp -frp ./kubectl /usr/local/bin/kubectl
sudo ln -sf /usr/local/bin/kubectl /usr/bin/kubectl
Expand All @@ -119,7 +132,6 @@ kubectl version --client
echo "==============================="

echo "Installing Helm for AMD64 / ARM64"
HELM_VERSION=${HELM_VERSION:-"latest"}
if [ "${HELM_VERSION}" = "latest" ]; then
HELM_VERSION=$(curl -s https://api.github.com/repos/helm/helm/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
Expand Down

0 comments on commit a1f0a53

Please sign in to comment.