From 48407365376babc38e44aae06e431927f0724ff9 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Thu, 18 Jan 2024 21:24:02 +0100 Subject: [PATCH 1/5] Update air-gapped registry path --- air_gapped/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/air_gapped/build.sh b/air_gapped/build.sh index ccbb08850d03d..bb91a39fc704e 100755 --- a/air_gapped/build.sh +++ b/air_gapped/build.sh @@ -4,7 +4,7 @@ set -eo pipefail -export AIR_GAPPED=docker.elastic.co/docs-private/air_gapped:latest +export AIR_GAPPED=docker.elastic.co/docs-private/bk_air_gapped:latest cd $(git rev-parse --show-toplevel) From 8bef21e9ef0f77b57507f95518d076a3fd5c69f2 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Thu, 18 Jan 2024 21:30:19 +0100 Subject: [PATCH 2/5] Switch to using master and drop the _bk_ prefix for Buildkite builds --- .buildkite/air_gapped_pipeline.yml | 2 +- .buildkite/build_pipeline.yml | 8 -- .buildkite/build_pr_pipeline.yml | 8 -- .buildkite/scripts/build.sh | 3 +- .buildkite/scripts/build_pr.sh | 2 +- .../scripts/compare_bk_jenkins_branches.sh | 81 ------------------- 6 files changed, 3 insertions(+), 101 deletions(-) delete mode 100755 .buildkite/scripts/compare_bk_jenkins_branches.sh diff --git a/.buildkite/air_gapped_pipeline.yml b/.buildkite/air_gapped_pipeline.yml index f0f5f5fbc6bab..9c744010bb5e6 100644 --- a/.buildkite/air_gapped_pipeline.yml +++ b/.buildkite/air_gapped_pipeline.yml @@ -2,7 +2,7 @@ steps: - label: ":white_check_mark: Build air-gapped" command: ".buildkite/scripts/publish_air_gapped_docs.sh" env: - AIR_GAPPED: "docker.elastic.co/docs-private/bk_air_gapped:latest" + AIR_GAPPED: "docker.elastic.co/docs-private/air_gapped:latest" agents: provider: "gcp" image: family/docs-ubuntu-2204 diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index ecd3cab3699dd..e2defd2ac51be 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -34,14 +34,6 @@ steps: provider: "gcp" image: family/docs-ubuntu-2204 machineType: ${BUILD_MACHINE_TYPE} - - wait - - key: "branch-comparison" - label: "Compare branches" - command: | - .buildkite/scripts/compare_bk_jenkins_branches.sh staging master - agents: - provider: "gcp" - image: family/docs-ubuntu-2204 notify: - email: "docs-status@elastic.co" if: build.state == "failed" diff --git a/.buildkite/build_pr_pipeline.yml b/.buildkite/build_pr_pipeline.yml index 3c5225b9ef6c7..76c21c1851719 100644 --- a/.buildkite/build_pr_pipeline.yml +++ b/.buildkite/build_pr_pipeline.yml @@ -27,11 +27,3 @@ steps: fi depends_on: - step: "build-pr" - - wait - - key: "branch-comparison" - label: "Compare branches" - command: | - .buildkite/scripts/compare_bk_jenkins_branches.sh ${GITHUB_PR_BASE_REPO}_bk_${GITHUB_PR_NUMBER} ${GITHUB_PR_BASE_REPO}_${GITHUB_PR_NUMBER} - agents: - provider: "gcp" - image: family/docs-ubuntu-2204 diff --git a/.buildkite/scripts/build.sh b/.buildkite/scripts/build.sh index 0eb9756ccf0e8..831e7684606e9 100755 --- a/.buildkite/scripts/build.sh +++ b/.buildkite/scripts/build.sh @@ -25,8 +25,7 @@ elif [[ "${BROKEN_LINKS}" == 'warnlinkcheck' ]]; then fi if [[ "${BUILDKITE_BRANCH}" == "master" ]]; then - # temporary pushing to staging instead of master until the migration is over - build_args+=" --target_branch staging --push" + build_args+=" --push" fi # The docs build can use the ssh agent's authentication socket diff --git a/.buildkite/scripts/build_pr.sh b/.buildkite/scripts/build_pr.sh index 39cdd321c338f..05aa2585b088f 100755 --- a/.buildkite/scripts/build_pr.sh +++ b/.buildkite/scripts/build_pr.sh @@ -70,7 +70,7 @@ fi # Set the target branch and preview options -TARGET_BRANCH="${GITHUB_PR_BASE_REPO}_bk_${GITHUB_PR_NUMBER}" +TARGET_BRANCH="${GITHUB_PR_BASE_REPO}_${GITHUB_PR_NUMBER}" PREVIEW_URL="https://${TARGET_BRANCH}.docs-preview.app.elstc.co" build_cmd="./build_docs --all \ diff --git a/.buildkite/scripts/compare_bk_jenkins_branches.sh b/.buildkite/scripts/compare_bk_jenkins_branches.sh deleted file mode 100755 index 9b9765aeaafd9..0000000000000 --- a/.buildkite/scripts/compare_bk_jenkins_branches.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -BUILDKITE_BRANCH=$1 -JENKINS_BRANCH=$2 - -if [ -z ${BUILDKITE_BRANCH} ] || [ -z ${JENKINS_BRANCH} ];then - echo "Missing BUILDKITE_BRANCH or JENKINS_BRANCH - aborting" - exit 1 -fi - -buildkite-agent annotate \ - --style 'info' \ - --context 'branch-comparison' \ - "Attempting to perform programatic comparison of [$BUILDKITE_BRANCH..$JENKINS_BRANCH](https://github.com/elastic/built-docs/compare/$BUILDKITE_BRANCH..$JENKINS_BRANCH)" - -# Start by fetching the 2 branches -git clone --reference /opt/git-mirrors/elastic-built-docs git@github.com:elastic/built-docs.git built-docs - -cd built-docs - -# Check if we're expecting a remote branch -git ls-remote --exit-code --heads origin $BUILDKITE_BRANCH -bk=$? - -if [ $bk -ne 0 ]; then - buildkite-agent annotate \ - --append \ - --context 'branch-comparison' \ - "No branches produced - aborting" - buildkite-agent meta-data set "bk-jenkins-branch-comparison" "skipping-no-branches" - exit 0 -fi - -# Let's sleep a few minutes to let Jenkins catch-up -sleep 3m - -git ls-remote --exit-code --heads origin $JENKINS_BRANCH -jen=$? - -if [ $jen -ne 0 ]; then - buildkite-agent annotate \ - --append \ - --context 'branch-comparison' \ - "[Jenkins branch](https://github.com/elastic/built-docs/tree/$JENKINS_BRANCH) not found in time - aborting" - buildkite-agent meta-data set "bk-jenkins-branch-comparison" "skipping-missing-jenkins-branch" - exit 0 -fi - -echo "Fetching Jenkins branch" -git fetch origin $JENKINS_BRANCH:$JENKINS_BRANCH - -echo "Fetching Buildkite branch" -git fetch origin $BUILDKITE_BRANCH:$BUILDKITE_BRANCH - -git --no-pager log -1 --format=%ct $JENKINS_BRANCH -jen=$? -git --no-pager log -1 --format=%ct $BUILDKITE_BRANCH -bk=$? - - -branches_age_diff=`expr $bk - $jen` -echo "Branches age difference (s) is $branches_age_diff" -if [ "$branches_age_diff" -gt 1800 ]; then - buildkite-agent annotate --append --context 'branch-comparison' "
Jenkins and Buildkite branches are more than 30 minutes apart - skipping comparison" - buildkite-agent meta-data set "bk-jenkins-branch-comparison" "skipping-age-difference" - exit 0 -fi - -echo "Comparing the two branches, excluding branches.yaml changes, and changes with /tmp or in them" -diff_out=`git diff $BUILDKITE_BRANCH..$JENKINS_BRANCH -- . ':(exclude)html/branches.yaml' | grep -v "\-\-\-" | grep -E "^\-|Binary" | grep -vE "\/tmp|"` -retVal=$? - -if [ $retVal -eq 0 ]; then - buildkite-agent annotate --append --style 'warning' --context 'branch-comparison' '
Branches differ' - buildkite-agent meta-data set "bk-jenkins-branch-comparison" "different" - echo $diff_out -else - buildkite-agent annotate --append --style 'success' --context 'branch-comparison' '
Branches are identical' - buildkite-agent meta-data set "bk-jenkins-branch-comparison" "identical" -fi - From d2ed77a673b62699cabc1c819efab7f9f5244dc0 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Thu, 18 Jan 2024 21:33:24 +0100 Subject: [PATCH 3/5] update GH action to drop Jenkins references --- .github/actions/docs-preview/action.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/actions/docs-preview/action.yml b/.github/actions/docs-preview/action.yml index 5c482af23934f..9ed678a92e036 100644 --- a/.github/actions/docs-preview/action.yml +++ b/.github/actions/docs-preview/action.yml @@ -28,14 +28,10 @@ runs: const { REPO, PR, PREVIEW_PATH } = process.env const comment = `A documentation preview will be available soon.
- Help us out by validating the Buildkite preview and reporting issues [here](https://github.com/elastic/docs/issues/new?labels=buildkite-migration,bug). - Please also be sure to **double check all images to ensure they are correct** in the preview. - ๐Ÿ”จ Buildkite [builds](https://buildkite.com/elastic/docs-build-pr/builds?meta_data[repo_pr]=${REPO}_${PR}) - - ๐Ÿ“š HTML diff: [Buildkite](https://${REPO}_bk_${PR}.docs-preview.app.elstc.co/diff) - [Jenkins](https://${REPO}_${PR}.docs-preview.app.elstc.co/diff) - - ๐Ÿ“™ Preview: [Buildkite](https://${REPO}_bk_${PR}.docs-preview.app.elstc.co/${PREVIEW_PATH}) - [Jenkins](https://${REPO}_${PR}.docs-preview.app.elstc.co/${PREVIEW_PATH}) - - ๐Ÿงช [Buildkite vs Jenkins diff](https://github.com/elastic/built-docs/compare/${REPO}_bk_${PR}..${REPO}_${PR}) - + - ๐Ÿ“š HTML [diff](https://${REPO}_${PR}.docs-preview.app.elstc.co/diff) + - ๐Ÿ“™ Preview [page](https://${REPO}_${PR}.docs-preview.app.elstc.co/${PREVIEW_PATH})
Request a new doc build by commenting From 7abf6266bd8fe44739c71318d78ab0c70a0cfb7c Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Tue, 6 Feb 2024 10:24:17 +0100 Subject: [PATCH 4/5] Remove secrets fetching that are no longer needed since we're using PAT --- .buildkite/hooks/pre-command | 3 --- 1 file changed, 3 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index a32d65623e9ed..7a971eaf23b3f 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -27,14 +27,11 @@ export BUILD_MACHINE_TYPE="n2-standard-4" # Secrets must be redacted # https://buildkite.com/docs/pipelines/managing-log-output#redacted-environment-variables if [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build-pr" ]];then - export GITHUB_TOKEN=$(retry 5 vault kv get -field=value secret/ci/elastic-docs/docs_preview_cleaner) export BUILDKITE_API_TOKEN=$(retry 5 vault kv get -field=value secret/ci/elastic-docs/buildkite_token) if [[ ${GITHUB_PR_BASE_REPO:="unset"} == "docs" ]]; then # Docs PR require a full rebuild - so let's boost the builds so they don't take 2 hours export BUILD_MACHINE_TYPE="n2-highcpu-32" fi -elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-preview-cleaner" ]];then - export GITHUB_TOKEN=$(retry 5 vault kv get -field=value secret/ci/elastic-docs/docs_preview_cleaner) elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build" ]];then export BUILD_MACHINE_TYPE="n2-highcpu-32" fi From 9c333953d15e086316ca4190e5fe904c259e9521 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Wed, 7 Feb 2024 17:04:07 +0100 Subject: [PATCH 5/5] Maintain the _bk_ in the Buildkite PRs - this is less confusing --- .buildkite/scripts/build_pr.sh | 2 +- .github/actions/docs-preview/action.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/scripts/build_pr.sh b/.buildkite/scripts/build_pr.sh index 05aa2585b088f..39cdd321c338f 100755 --- a/.buildkite/scripts/build_pr.sh +++ b/.buildkite/scripts/build_pr.sh @@ -70,7 +70,7 @@ fi # Set the target branch and preview options -TARGET_BRANCH="${GITHUB_PR_BASE_REPO}_${GITHUB_PR_NUMBER}" +TARGET_BRANCH="${GITHUB_PR_BASE_REPO}_bk_${GITHUB_PR_NUMBER}" PREVIEW_URL="https://${TARGET_BRANCH}.docs-preview.app.elstc.co" build_cmd="./build_docs --all \ diff --git a/.github/actions/docs-preview/action.yml b/.github/actions/docs-preview/action.yml index 9ed678a92e036..a63cbf224556c 100644 --- a/.github/actions/docs-preview/action.yml +++ b/.github/actions/docs-preview/action.yml @@ -30,8 +30,8 @@ runs: const comment = `A documentation preview will be available soon.
- ๐Ÿ”จ Buildkite [builds](https://buildkite.com/elastic/docs-build-pr/builds?meta_data[repo_pr]=${REPO}_${PR}) - - ๐Ÿ“š HTML [diff](https://${REPO}_${PR}.docs-preview.app.elstc.co/diff) - - ๐Ÿ“™ Preview [page](https://${REPO}_${PR}.docs-preview.app.elstc.co/${PREVIEW_PATH}) + - ๐Ÿ“š HTML [diff](https://${REPO}_bk_${PR}.docs-preview.app.elstc.co/diff) + - ๐Ÿ“™ Preview [page](https://${REPO}_bk_${PR}.docs-preview.app.elstc.co/${PREVIEW_PATH})
Request a new doc build by commenting