Skip to content
Draft
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
9 changes: 2 additions & 7 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ name: Release
on:
workflow_dispatch:
inputs:
version_v1:
required: true
type: string
description: "Version number for v1 docs, in #.#.# format"

version_v2:
required: true
type: string
Expand Down Expand Up @@ -40,11 +35,11 @@ jobs:
git config user.name "jaegertracingbot"
git config user.email "jaegertracingbot+jaeger-tracing@googlegroups.com"
export DRY_RUN=${{ inputs.dry_run }}
./scripts/release.sh ${{ inputs.version_v1 }} ${{ inputs.version_v2 }}
./scripts/release.sh ${{ inputs.version_v2 }}

- name: GH CLI create PR
run: |
export TAG="${{ inputs.version_v2 }}/${{ inputs.version_v1 }}"
export TAG="${{ inputs.version_v2 }}"
gh pr create --base main --title "Release ${TAG}" --body "Release ${TAG}. This PR is created from CI and is part of the release process."
env:
GH_TOKEN: ${{ secrets.JAEGERTRACINGBOT_PAT }}
6 changes: 1 addition & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ Before creating a new release:
- Make sure the actual Jaeger release is done and Docker images for the new version are published.

To create a new release:
- Manually trigger the [Release](https://github.com/jaegertracing/documentation/actions/workflows/ci-release.yml) workflow on GitHub. It will ask for v1 and v2 version numbers (same versions as in the main Jaeger repo), and create a [pull request](https://github.com/jaegertracing/documentation/pulls) with the documentation changes.
- Manually trigger the [Release](https://github.com/jaegertracing/documentation/actions/workflows/ci-release.yml) workflow on GitHub. It will ask for the v2 version number (same version as in the main Jaeger repo), and create a [pull request](https://github.com/jaegertracing/documentation/pulls) with the documentation changes.
- Approve and merge that pull request.
- Because the site is statically generated, the release is completed after the merge.
- The workflow is using a bot token which expires every year, see https://github.com/jaegertracing/documentation/issues/1037.

<!-- END_CHECKLIST -->

### Auto-generated documentation for CLI flags

The docs for the Jaeger CLI tools are generated by the automated release process described above using the Python script [`scripts/gen-cli-data.py`](./scripts/gen-cli-data.py). It uses the configuration file `data/cli/next-release/config.json` (automatically copied to `data/cli/${NEXT_VERSION}/config.json`) that describes which Jaeger binaries to include in the documentation, and which storage options each binary supports. The script invokes the `docs` command on the respective Docker images for each binary and creates a set of YAML files under `data/cli/${NEXT_VERSION}/`, which are then used by the template engine to render the CLI docs.
72 changes: 21 additions & 51 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# SPDX-License-Identifier: Apache-2.0

# Prepares a pull request for the next release.
# Set environment variable DRY_RUN=true to skip committing the changes,
# or set DRY_RUN=no-cli-docs to also skip generating the CLI docs.
# Set environment variable DRY_RUN=true to skip committing the changes.

set -euf -o errexit -o pipefail

Expand All @@ -14,27 +13,21 @@ SED=${SED:-sed}
config_file=hugo.yaml

print_usage() {
echo "Usage: $0 <version_v1> <version_v2>"
echo " Both versions must be in #.#.# format (major, minor, patch)"
echo "Usage: $0 <version_v2>"
echo " Version must be in #.#.# format (major, minor, patch)"
exit 1
}

if [ "$#" -ne 2 ]; then
if [ "$#" -ne 1 ]; then
print_usage
fi

if [[ "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
version_v1="$1"
version_v2="$1"
else
echo "🔴 ERROR: Version $1 is not in a major.minor.patch format."
print_usage
fi
if [[ "$2" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
version_v2="$2"
else
echo "🔴 ERROR: Version $2 is not in a major.minor.patch format."
print_usage
fi

safe_checkout_main() {
# We need to be on a branch to be able to create commits,
Expand Down Expand Up @@ -82,56 +75,33 @@ update_links() {
done
}

gen_cli_docs_v1() {
local versionMajorMinor=$1
# we set this as a temp dir with write permissions to everyone to overcome #441
# we then set the permissions back to sane levels once we are done
cliDocsTempDir=$(mktemp -d -t cli-docs-XXXXXXXX)
mkdir -p ${cliDocsTempDir}/data/cli
cp -r ./data/cli/next-release/ ${cliDocsTempDir}/data/cli/${versionMajorMinor}
chmod -R a+w ${cliDocsTempDir}
if [[ "$DRY_RUN" != "no-cli-docs" ]]; then
python3 ./scripts/gen-cli-data.py ${versionMajorMinor} ${cliDocsTempDir}
fi
rm -f ${cliDocsTempDir}/data/cli/${versionMajorMinor}/*_completion_*.yaml
mv ${cliDocsTempDir}/data/cli/${versionMajorMinor} ./data/cli/
}

set -x
safe_checkout_main

for version in "${version_v1}" "${version_v2}"; do
versionMajorMinor=$(echo "${version}" | ${SED} 's/\.[[:digit:]]$//')
echo "Creating new documentation for ${version} (${versionMajorMinor})"
var_suffix=""
if [[ "${versionMajorMinor}" == 2* ]]; then
cp -r ./content/docs/v2/_dev/ ./content/docs/v2/${versionMajorMinor}
var_suffix="V2"
else
cp -r ./content/docs/v1/_dev/ ./content/docs/v1/${versionMajorMinor}
gen_cli_docs_v1 ${versionMajorMinor}
fi
versionMajorMinor=$(echo "${version_v2}" | ${SED} 's/\.[[:digit:]]$//')
echo "Creating new documentation for ${version_v2} (${versionMajorMinor})"

update_links "${versionMajorMinor}" "${version}"
cp -r ./content/docs/v2/_dev/ ./content/docs/v2/${versionMajorMinor}

versions=$(grep -E "versions${var_suffix} *:" "${config_file}")
if [[ "$versions" == *"$versionMajorMinor"* ]]; then
echo "🔴 ERROR: Version ${versionMajorMinor} is already included in the versions list."
exit 1
fi
update_links "${versionMajorMinor}" "${version_v2}"

versions=$(grep -E "versionsV2 *:" "${config_file}")
if [[ "$versions" == *"$versionMajorMinor"* ]]; then
echo "🔴 ERROR: Version ${versionMajorMinor} is already included in the versions list."
exit 1
fi

${SED} -i -e "s/latest${var_suffix} *:.*$/latest${var_suffix}: \"${versionMajorMinor}\"/" "${config_file}"
${SED} -i -e "s/binariesLatest${var_suffix} *:.*$/binariesLatest${var_suffix}: \"${version}\"/" "${config_file}"
${SED} -i -e "s/versions${var_suffix} *: *\[/versions${var_suffix}: \[\"${versionMajorMinor}\"\,/" "${config_file}"
done
${SED} -i -e "s/latestV2 *:.*$/latestV2: \"${versionMajorMinor}\"/" "${config_file}"
${SED} -i -e "s/binariesLatestV2 *:.*$/binariesLatestV2: \"${version_v2}\"/" "${config_file}"
${SED} -i -e "s/versionsV2 *: *\[/versionsV2: \[\"${versionMajorMinor}\"\,/" "${config_file}"

if [[ "$DRY_RUN" != "false" ]]; then
echo "Not committing changes because DRY_RUN=$DRY_RUN"
exit 0
fi

BRANCH="gen-release-${version_v2}/${version_v1}"
BRANCH="gen-release-${version_v2}"
git checkout -b "$BRANCH" # branch is needed for GH CLI
git add ${config_file} ./content/docs/ ./data/cli/
git commit -s -m "Release ${version_v2}/${version_v1}"
git add ${config_file} ./content/docs/
git commit -s -m "Release ${version_v2}"
git push origin HEAD:"$BRANCH" # branch has to be on remote before PR is opened