From 0bb4951aa06f720613723885d8158fc5180793cb Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 12:46:32 -0800 Subject: [PATCH 01/36] check if docs repo has changed --- .buildkite/build_pipeline.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index d68c6db6d3f76..ae6697734ccca 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -25,6 +25,19 @@ steps: value: "" hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." - wait + - label: "Full rebuild or incremental rebuild?" + if: build.source == "schedule" + command: | + LAST_BUILD_COMMIT=$(buildkite-agent meta get last_build_commit) + CURRENT_COMMIT=$(git rev-parse HEAD) + if [[ "$CURRENT_COMMIT" != "$LAST_BUILD_COMMIT" ]]; then + echo "The docs repo has changed since the last build." + export REBUILD="rebuild" + else + echo "The docs repo has not changed since the last build." + export REBUILD="" + fi + - wait - label: ":white_check_mark: Build docs" command: | export REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" From eaa67df4dae73e0e5e0a3bd5bd58cbdd58e0c0ee Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 12:51:36 -0800 Subject: [PATCH 02/36] more --- .buildkite/build_pipeline.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index ae6697734ccca..270d17bb1afd6 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -25,17 +25,17 @@ steps: value: "" hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." - wait - - label: "Full rebuild or incremental rebuild?" + - label: "Full rebuild or incremental build?" if: build.source == "schedule" command: | LAST_BUILD_COMMIT=$(buildkite-agent meta get last_build_commit) CURRENT_COMMIT=$(git rev-parse HEAD) if [[ "$CURRENT_COMMIT" != "$LAST_BUILD_COMMIT" ]]; then echo "The docs repo has changed since the last build." - export REBUILD="rebuild" + buildkite-agent meta-data set "REBUILD" "rebuild" else echo "The docs repo has not changed since the last build." - export REBUILD="" + buildkite-agent meta-data set "REBUILD" "" fi - wait - label: ":white_check_mark: Build docs" From 0ea95ca9ab5771ed7af54548632e263bada680bb Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 18:13:41 -0800 Subject: [PATCH 03/36] updates so I can test it --- .buildkite/build_pipeline.yml | 61 ++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 270d17bb1afd6..1d27d8d72f49f 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -1,32 +1,34 @@ steps: - - input: "Build parameters" - if: build.source == "ui" - fields: - - select: "Rebuild?" - key: "REBUILD" - default: "" - required: false - options: - - label: "no" - value: "" - - label: "yes" - value: "rebuild" - hint: "Should all books be rebuilt, regardless of what has changed? Build once with this set to true after every release." - - select: "How should broken links be handled?" - key: "BROKEN_LINKS" - default: "" - required: false - options: - - label: "Continue without warning" - value: "skiplinkcheck" - - label: "Continue, but log a warning" - value: "warnlinkcheck" - - label: "Fail the build" - value: "" - hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." - - wait + # - input: "Build parameters" + # if: build.source == "ui" + # fields: + # - select: "Rebuild?" + # key: "REBUILD" + # default: "" + # required: false + # options: + # - label: "no" + # value: "" + # - label: "yes" + # value: "rebuild" + # hint: "Should all books be rebuilt, regardless of what has changed? Build once with this set to true after every release." + # - select: "How should broken links be handled?" + # key: "BROKEN_LINKS" + # default: "" + # required: false + # options: + # - label: "Continue without warning" + # value: "skiplinkcheck" + # - label: "Continue, but log a warning" + # value: "warnlinkcheck" + # - label: "Fail the build" + # value: "" + # hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." + # - wait - label: "Full rebuild or incremental build?" - if: build.source == "schedule" + # this has to be changed for testing purposes + # if: build.source == "schedule" + if: build.source == "ui" command: | LAST_BUILD_COMMIT=$(buildkite-agent meta get last_build_commit) CURRENT_COMMIT=$(git rev-parse HEAD) @@ -40,8 +42,9 @@ steps: - wait - label: ":white_check_mark: Build docs" command: | - export REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" - export BROKEN_LINKS="$(buildkite-agent meta-data get BROKEN_LINKS --default '' --log-level fatal)" + echo REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" + # export REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" + # export BROKEN_LINKS="$(buildkite-agent meta-data get BROKEN_LINKS --default '' --log-level fatal)" bash .buildkite/scripts/build.sh agents: provider: "gcp" From 9694e32d4a14fe410735e9bcabfd9b34ec830d56 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 18:23:57 -0800 Subject: [PATCH 04/36] build commit --- .buildkite/build_pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 1d27d8d72f49f..8f2ea02d98810 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -30,6 +30,7 @@ steps: # if: build.source == "schedule" if: build.source == "ui" command: | + echo \"Build commit is: ${BUILDKITE_COMMIT}\" LAST_BUILD_COMMIT=$(buildkite-agent meta get last_build_commit) CURRENT_COMMIT=$(git rev-parse HEAD) if [[ "$CURRENT_COMMIT" != "$LAST_BUILD_COMMIT" ]]; then From 4ef96143459298c2ebb84bc9b7dd6f99221f9759 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 18:26:52 -0800 Subject: [PATCH 05/36] lbc --- .buildkite/build_pipeline.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 8f2ea02d98810..99be711182dd3 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -30,10 +30,14 @@ steps: # if: build.source == "schedule" if: build.source == "ui" command: | - echo \"Build commit is: ${BUILDKITE_COMMIT}\" + # this works + echo "Build commit is: ${BUILDKITE_COMMIT}" + LAST_BUILD_COMMIT=$(buildkite-agent meta get last_build_commit) CURRENT_COMMIT=$(git rev-parse HEAD) - if [[ "$CURRENT_COMMIT" != "$LAST_BUILD_COMMIT" ]]; then + + echo "Last build commit: $(buildkite-agent meta get last_build_commit)" + if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then echo "The docs repo has changed since the last build." buildkite-agent meta-data set "REBUILD" "rebuild" else From 92df13173524a33718bb69f4e40c2b73f7632d30 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 19:02:57 -0800 Subject: [PATCH 06/36] gpb --- .buildkite/build_pipeline.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 99be711182dd3..0f315f4374c34 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -32,9 +32,8 @@ steps: command: | # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - - LAST_BUILD_COMMIT=$(buildkite-agent meta get last_build_commit) - CURRENT_COMMIT=$(git rev-parse HEAD) + GET_PREVIOUS_BUILDS=$(curl https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed) + echo "$GET_PREVIOUS_BUILDS" echo "Last build commit: $(buildkite-agent meta get last_build_commit)" if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then From dfcd5ab424d8f6ae4c24a1e67e003b67024c4a68 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 19:27:22 -0800 Subject: [PATCH 07/36] more testing --- .buildkite/build_pipeline.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 0f315f4374c34..b8844fe93a59b 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -32,17 +32,18 @@ steps: command: | # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - GET_PREVIOUS_BUILDS=$(curl https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed) - echo "$GET_PREVIOUS_BUILDS" - echo "Last build commit: $(buildkite-agent meta get last_build_commit)" - if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then - echo "The docs repo has changed since the last build." - buildkite-agent meta-data set "REBUILD" "rebuild" - else - echo "The docs repo has not changed since the last build." - buildkite-agent meta-data set "REBUILD" "" - fi + output=$(curl GET https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed -H "Accept: application/json") + + echo "$output" + + # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then + # echo "The docs repo has changed since the last build." + # buildkite-agent meta-data set "REBUILD" "rebuild" + # else + # echo "The docs repo has not changed since the last build." + # buildkite-agent meta-data set "REBUILD" "" + # fi - wait - label: ":white_check_mark: Build docs" command: | From 3b563f5383edfa20b804cbe50bdd698c091764df Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 19:28:51 -0800 Subject: [PATCH 08/36] a --- .buildkite/build_pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index b8844fe93a59b..5afec1836aab0 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,9 +33,9 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - output=$(curl GET https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed -H "Accept: application/json") + curl GET https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed + - echo "$output" # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then # echo "The docs repo has changed since the last build." From a4649fcd42938e17be8e536355a856073a9709ec Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 19:32:26 -0800 Subject: [PATCH 09/36] b --- .buildkite/build_pipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 5afec1836aab0..c0b598b5edea6 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,8 +33,9 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - curl GET https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed - + OUTPUT=$(curl "https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed") + sleep 15 + echo $OUTPUT # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then From b50be86c911e8362101533cdc84301258ce20e89 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 19:34:59 -0800 Subject: [PATCH 10/36] mmhm --- .buildkite/build_pipeline.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index c0b598b5edea6..00cf2baa7f554 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,10 +33,7 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - OUTPUT=$(curl "https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed") - sleep 15 - echo $OUTPUT - + echo "$(curl https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed)" # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then # echo "The docs repo has changed since the last build." From 132847ed24798c3f85e0a01d2b9b711e6d970fbb Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 21:28:55 -0800 Subject: [PATCH 11/36] use auth token --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 00cf2baa7f554..bf79b5cba5036 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,7 +33,7 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - echo "$(curl https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed)" + echo "$(curl -H 'Authorization: Bearer ${BUILDKITE_API_TOKEN}' https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed)" # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then # echo "The docs repo has changed since the last build." From b06de72f9f88692f3ee2812fefa3f315c0f8d102 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 21:30:57 -0800 Subject: [PATCH 12/36] fix quotes --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index bf79b5cba5036..5a55dc17e73d7 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,7 +33,7 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - echo "$(curl -H 'Authorization: Bearer ${BUILDKITE_API_TOKEN}' https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed)" + echo "$(curl -H \"Authorization: Bearer ${BUILDKITE_API_TOKEN}\" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed)" # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then # echo "The docs repo has changed since the last build." From b715781079483791cc7e3e04c30334fcfe39c427 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 21:35:42 -0800 Subject: [PATCH 13/36] c --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 5a55dc17e73d7..5955452145215 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,7 +33,7 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - echo "$(curl -H \"Authorization: Bearer ${BUILDKITE_API_TOKEN}\" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed)" + echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed) # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then # echo "The docs repo has changed since the last build." From fea9cedf7b7d33f050d550707366f23d43cd52ad Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 21:41:35 -0800 Subject: [PATCH 14/36] aha! --- .buildkite/hooks/pre-command | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 8d11275d77097..f7be59739f3de 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -34,6 +34,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build-pr" ]];then fi elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build" ]];then export BUILD_MACHINE_TYPE="n2-highcpu-32" + export BUILDKITE_API_TOKEN=$(retry 5 vault kv get -field=value secret/ci/elastic-docs/buildkite_token) elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build-air-gapped" ]] && [[ "$BUILDKITE_STEP_KEY" == "publish-air-gapped-doc" ]]; then export DOCKER_USERNAME=$(retry 5 vault kv get -field=username secret/ci/elastic-docs/docker.elastic.co) export DOCKER_PASSWORD=$(retry 5 vault kv get -field=password secret/ci/elastic-docs/docker.elastic.co) From 215e20dff4fac7af354f08e5e744752f3748b7ae Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 21:54:37 -0800 Subject: [PATCH 15/36] no way this works --- .buildkite/build_pipeline.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 5955452145215..1dc86ac3195f8 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,15 +33,15 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed) + LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0] | {commit: .commit}' ) - # if [[ "${BUILDKITE_COMMIT}" != "$LAST_BUILD_COMMIT" ]]; then - # echo "The docs repo has changed since the last build." - # buildkite-agent meta-data set "REBUILD" "rebuild" - # else - # echo "The docs repo has not changed since the last build." - # buildkite-agent meta-data set "REBUILD" "" - # fi + if [[ "${BUILDKITE_COMMIT}" != "$LAST_SUCCESSFUL_COMMIT" ]]; then + echo "The docs repo has changed since the last build." + buildkite-agent meta-data set "REBUILD" "rebuild" + else + echo "The docs repo has not changed since the last build." + buildkite-agent meta-data set "REBUILD" "" + fi - wait - label: ":white_check_mark: Build docs" command: | From b1bf2aecb7ca4b030fd2449b571e6dad55b88f1b Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 21:58:24 -0800 Subject: [PATCH 16/36] forgot the squigles --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 1dc86ac3195f8..acaabc2bd7d0c 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -35,7 +35,7 @@ steps: LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0] | {commit: .commit}' ) - if [[ "${BUILDKITE_COMMIT}" != "$LAST_SUCCESSFUL_COMMIT" ]]; then + if [[ "${BUILDKITE_COMMIT}" != "${LAST_SUCCESSFUL_COMMIT}" ]]; then echo "The docs repo has changed since the last build." buildkite-agent meta-data set "REBUILD" "rebuild" else From 840bd3c6df5e101eaa94a5f1f3a2689feff85c85 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:06:00 -0800 Subject: [PATCH 17/36] back up --- .buildkite/build_pipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index acaabc2bd7d0c..0a5ee6d96889b 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,7 +33,9 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0] | {commit: .commit}' ) + LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0]' ) + + echo "${LAST_SUCCESSFUL_COMMIT}" if [[ "${BUILDKITE_COMMIT}" != "${LAST_SUCCESSFUL_COMMIT}" ]]; then echo "The docs repo has changed since the last build." From 0f64c0085014121cbeae4d833da1e4ac62bdfc16 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:18:22 -0800 Subject: [PATCH 18/36] perhaps --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 0a5ee6d96889b..0ac2f58edaf86 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,7 +33,7 @@ steps: # this works echo "Build commit is: ${BUILDKITE_COMMIT}" - LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0]' ) + LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit' ) echo "${LAST_SUCCESSFUL_COMMIT}" From 65c95cc7f6530533e2ae76e67ec1173f3c2e4c8c Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:24:12 -0800 Subject: [PATCH 19/36] lsc --- .buildkite/build_pipeline.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 0ac2f58edaf86..0859510bc5b44 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -30,12 +30,10 @@ steps: # if: build.source == "schedule" if: build.source == "ui" command: | - # this works - echo "Build commit is: ${BUILDKITE_COMMIT}" + LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') - LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit' ) - - echo "${LAST_SUCCESSFUL_COMMIT}" + echo "Build commit: ${BUILDKITE_COMMIT}" + echo "Last successful commit: ${LAST_SUCCESSFUL_COMMIT}" if [[ "${BUILDKITE_COMMIT}" != "${LAST_SUCCESSFUL_COMMIT}" ]]; then echo "The docs repo has changed since the last build." From 9e266fef48f2150c48ec1892e951c57f9f4e713d Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:27:03 -0800 Subject: [PATCH 20/36] no squigs --- .buildkite/build_pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 0859510bc5b44..2b28a5e5a1b85 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -33,9 +33,9 @@ steps: LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') echo "Build commit: ${BUILDKITE_COMMIT}" - echo "Last successful commit: ${LAST_SUCCESSFUL_COMMIT}" + echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" - if [[ "${BUILDKITE_COMMIT}" != "${LAST_SUCCESSFUL_COMMIT}" ]]; then + if [[ "${BUILDKITE_COMMIT}" != "$LAST_SUCCESSFUL_COMMIT" ]]; then echo "The docs repo has changed since the last build." buildkite-agent meta-data set "REBUILD" "rebuild" else From 57deb0cc19ed52977cfbc4c3776aa4c1fb6cb01e Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:29:48 -0800 Subject: [PATCH 21/36] =?UTF-8?q?jq=20isn=E2=80=99t=20working?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .buildkite/build_pipeline.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 2b28a5e5a1b85..333c8669b6288 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -30,7 +30,11 @@ steps: # if: build.source == "schedule" if: build.source == "ui" command: | - LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') + echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') + + echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0]') + + # LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') echo "Build commit: ${BUILDKITE_COMMIT}" echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" From 25ab6a6ca65f5e41633aea5c88c4ddce184c4f7d Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:33:17 -0800 Subject: [PATCH 22/36] quotes --- .buildkite/build_pipeline.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 333c8669b6288..97b01842f3871 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -30,9 +30,7 @@ steps: # if: build.source == "schedule" if: build.source == "ui" command: | - echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') - - echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0]') + echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq ".[0].commit") # LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') From fcf36d5798bffc50b1172a0b3c7da96cad34b6e0 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:39:59 -0800 Subject: [PATCH 23/36] try a file --- .buildkite/build_pipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 97b01842f3871..fc6498c9acac2 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -30,7 +30,9 @@ steps: # if: build.source == "schedule" if: build.source == "ui" command: | - echo $(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq ".[0].commit") + curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed >> output.json + + LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '[.0].commit') # LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') From 9c533a5f84d89b6215732449621edbde7744361c Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:47:28 -0800 Subject: [PATCH 24/36] ugh --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index fc6498c9acac2..5521fa056db5d 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -32,7 +32,7 @@ steps: command: | curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed >> output.json - LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '[.0].commit') + LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0].commit') # LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') From 14ff55a45ed5ba24d7db7decab40c9e35999316b Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:50:08 -0800 Subject: [PATCH 25/36] d --- .buildkite/build_pipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 5521fa056db5d..b1c5224007e9e 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -32,7 +32,9 @@ steps: command: | curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed >> output.json - LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0].commit') + echo $(LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0]')) + + # LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0].commit') # LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') From 0abdfa7f5760c21a4ca7723c6f6fd41748e88fcc Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 22:51:53 -0800 Subject: [PATCH 26/36] e --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index b1c5224007e9e..08516739cbd07 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -32,7 +32,7 @@ steps: command: | curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed >> output.json - echo $(LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0]')) + echo "$(LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0]'))" # LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0].commit') From 163784ae2773538fdf4493067d6483c33a2ef3b9 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Thu, 8 Feb 2024 23:17:25 -0800 Subject: [PATCH 27/36] move to file, echo all the things --- .buildkite/build_pipeline.yml | 20 +------------------- .buildkite/scripts/compare_commits.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 .buildkite/scripts/compare_commits.sh diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 08516739cbd07..472476b207753 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -29,25 +29,7 @@ steps: # this has to be changed for testing purposes # if: build.source == "schedule" if: build.source == "ui" - command: | - curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed >> output.json - - echo "$(LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0]'))" - - # LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0].commit') - - # LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') - - echo "Build commit: ${BUILDKITE_COMMIT}" - echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" - - if [[ "${BUILDKITE_COMMIT}" != "$LAST_SUCCESSFUL_COMMIT" ]]; then - echo "The docs repo has changed since the last build." - buildkite-agent meta-data set "REBUILD" "rebuild" - else - echo "The docs repo has not changed since the last build." - buildkite-agent meta-data set "REBUILD" "" - fi + command: bash .buildkite/scripts/compare-commits.sh - wait - label: ":white_check_mark: Build docs" command: | diff --git a/.buildkite/scripts/compare_commits.sh b/.buildkite/scripts/compare_commits.sh new file mode 100644 index 0000000000000..7bf788182a558 --- /dev/null +++ b/.buildkite/scripts/compare_commits.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed > output.json + +# LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0]') + +LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') + +echo "Build commit: ${BUILDKITE_COMMIT}" +echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" + +if [[ "${BUILDKITE_COMMIT}" != "$LAST_SUCCESSFUL_COMMIT" ]]; then + echo "The docs repo has changed since the last build." + echo buildkite-agent meta-data set "REBUILD" "rebuild" +else + echo "The docs repo has not changed since the last build." + echo buildkite-agent meta-data set "REBUILD" "" +fi \ No newline at end of file From 0e55959f0ff3a31cecb4445e0306273ca9d3c845 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 08:46:27 +0100 Subject: [PATCH 28/36] Fixing up the script - mostly adding curl and jq flags --- .buildkite/scripts/compare_commits.sh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) mode change 100644 => 100755 .buildkite/scripts/compare_commits.sh diff --git a/.buildkite/scripts/compare_commits.sh b/.buildkite/scripts/compare_commits.sh old mode 100644 new mode 100755 index 7bf788182a558..49b29b8cf47f1 --- a/.buildkite/scripts/compare_commits.sh +++ b/.buildkite/scripts/compare_commits.sh @@ -1,18 +1,13 @@ #!/bin/bash -# curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed > output.json +last_successful_build_url="https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed" +LAST_SUCCESSFUL_COMMIT=$(curl -s -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" $last_successful_build_url | jq -r '.[0].commit') -# LAST_SUCCESSFUL_COMMIT=$(cat output.json | jq '.[0]') - -LAST_SUCCESSFUL_COMMIT=$(curl -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed | jq '.[0].commit') - -echo "Build commit: ${BUILDKITE_COMMIT}" -echo "Last successful commit: $LAST_SUCCESSFUL_COMMIT" - -if [[ "${BUILDKITE_COMMIT}" != "$LAST_SUCCESSFUL_COMMIT" ]]; then - echo "The docs repo has changed since the last build." - echo buildkite-agent meta-data set "REBUILD" "rebuild" -else +echo "Comparing the current docs build commit ${BUILDKITE_COMMIT} to the last successful build commit ${LAST_SUCCESSFUL_COMMIT}" +if [[ "$BUILDKITE_COMMIT" == "$LAST_SUCCESSFUL_COMMIT" ]]; then echo "The docs repo has not changed since the last build." - echo buildkite-agent meta-data set "REBUILD" "" -fi \ No newline at end of file + buildkite-agent meta-data set "REBUILD" "" +else + echo "The docs repo has changed since the last build." + buildkite-agent meta-data set "REBUILD" "rebuild" +fi From a285d0de450a4be43330faf7092616a42a9d2f0f Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 08:50:23 +0100 Subject: [PATCH 29/36] wire up the rebuild --- .buildkite/build_pipeline.yml | 6 ++---- .buildkite/scripts/build.sh | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 472476b207753..f8da18f67d53e 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -27,10 +27,8 @@ steps: # - wait - label: "Full rebuild or incremental build?" # this has to be changed for testing purposes - # if: build.source == "schedule" - if: build.source == "ui" - command: bash .buildkite/scripts/compare-commits.sh - - wait + #if: build.source == "schedule" + command: ".buildkite/scripts/compare-commits.sh" - label: ":white_check_mark: Build docs" command: | echo REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" diff --git a/.buildkite/scripts/build.sh b/.buildkite/scripts/build.sh index 831e7684606e9..4338d304574ff 100755 --- a/.buildkite/scripts/build.sh +++ b/.buildkite/scripts/build.sh @@ -2,7 +2,8 @@ set -euo pipefail set +x - +echo "rebuild value: $REBUILD" +exit 0 # Configure the git author and committer information export GIT_AUTHOR_NAME='Buildkite CI' export GIT_AUTHOR_EMAIL='docs-status+buildkite@elastic.co' From bd23c64b88f1176d3fb9f800f15020ba0151c62c Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 08:52:53 +0100 Subject: [PATCH 30/36] fix script typo --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index f8da18f67d53e..201c8f46f730a 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -28,7 +28,7 @@ steps: - label: "Full rebuild or incremental build?" # this has to be changed for testing purposes #if: build.source == "schedule" - command: ".buildkite/scripts/compare-commits.sh" + command: ".buildkite/scripts/compare_commits.sh" - label: ":white_check_mark: Build docs" command: | echo REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" From 94070db14022a26a84b8959c72f8c8e127034b0c Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 08:57:16 +0100 Subject: [PATCH 31/36] export rebuild var --- .buildkite/build_pipeline.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 201c8f46f730a..60895ef191480 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -26,14 +26,13 @@ steps: # hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." # - wait - label: "Full rebuild or incremental build?" - # this has to be changed for testing purposes + # this has to be commented out for testing purposes #if: build.source == "schedule" command: ".buildkite/scripts/compare_commits.sh" - label: ":white_check_mark: Build docs" command: | - echo REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" - # export REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" - # export BROKEN_LINKS="$(buildkite-agent meta-data get BROKEN_LINKS --default '' --log-level fatal)" + export REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" + export BROKEN_LINKS="$(buildkite-agent meta-data get BROKEN_LINKS --default '' --log-level fatal)" bash .buildkite/scripts/build.sh agents: provider: "gcp" From 5bc5c78ec58fa79fb3ffc80a2c72124958e73c9c Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 08:58:47 +0100 Subject: [PATCH 32/36] Make the script more generic --- .buildkite/scripts/compare_commits.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/compare_commits.sh b/.buildkite/scripts/compare_commits.sh index 49b29b8cf47f1..9d97781a53871 100755 --- a/.buildkite/scripts/compare_commits.sh +++ b/.buildkite/scripts/compare_commits.sh @@ -1,6 +1,6 @@ #!/bin/bash -last_successful_build_url="https://api.buildkite.com/v2/organizations/elastic/pipelines/docs-build/builds?branch=master&state=passed" +last_successful_build_url="https://api.buildkite.com/v2/organizations/elastic/pipelines/${BUILDKITE_PIPELINE_SLUG}/builds?branch=${BUILDKITE_BRANCH}&state=passed" LAST_SUCCESSFUL_COMMIT=$(curl -s -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" $last_successful_build_url | jq -r '.[0].commit') echo "Comparing the current docs build commit ${BUILDKITE_COMMIT} to the last successful build commit ${LAST_SUCCESSFUL_COMMIT}" From 164ef9634cf1082bc380a34b3c1aa4223ff8e82e Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 09:03:40 +0100 Subject: [PATCH 33/36] Set REBUILD value to false since empty strings are not accepted --- .buildkite/scripts/compare_commits.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/compare_commits.sh b/.buildkite/scripts/compare_commits.sh index 9d97781a53871..dc26fdba796e5 100755 --- a/.buildkite/scripts/compare_commits.sh +++ b/.buildkite/scripts/compare_commits.sh @@ -6,7 +6,7 @@ LAST_SUCCESSFUL_COMMIT=$(curl -s -H "Authorization: Bearer ${BUILDKITE_API_TOKEN echo "Comparing the current docs build commit ${BUILDKITE_COMMIT} to the last successful build commit ${LAST_SUCCESSFUL_COMMIT}" if [[ "$BUILDKITE_COMMIT" == "$LAST_SUCCESSFUL_COMMIT" ]]; then echo "The docs repo has not changed since the last build." - buildkite-agent meta-data set "REBUILD" "" + buildkite-agent meta-data set "REBUILD" "false" else echo "The docs repo has changed since the last build." buildkite-agent meta-data set "REBUILD" "rebuild" From 1b9b2af2bdbf67a5d6d9c7175040b8ab750711f0 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 09:04:54 +0100 Subject: [PATCH 34/36] Remove early exits used for testing purposes --- .buildkite/scripts/build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/scripts/build.sh b/.buildkite/scripts/build.sh index 4338d304574ff..831e7684606e9 100755 --- a/.buildkite/scripts/build.sh +++ b/.buildkite/scripts/build.sh @@ -2,8 +2,7 @@ set -euo pipefail set +x -echo "rebuild value: $REBUILD" -exit 0 + # Configure the git author and committer information export GIT_AUTHOR_NAME='Buildkite CI' export GIT_AUTHOR_EMAIL='docs-status+buildkite@elastic.co' From c3e82508a410a230ce278562ba07ae209d657266 Mon Sep 17 00:00:00 2001 From: nassimkammah Date: Fri, 9 Feb 2024 09:09:03 +0100 Subject: [PATCH 35/36] Try setting concurrency group name based on branch --- .buildkite/build_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 60895ef191480..5e6ef1c64b6c2 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -38,7 +38,7 @@ steps: provider: "gcp" image: family/docs-ubuntu-2204 machineType: ${BUILD_MACHINE_TYPE} - concurrency_group: build-docs + concurrency_group: build-docs-${BUILDKITE_BRANCH} concurrency: 1 notify: - email: "docs-status@elastic.co" From 5b3cadbea1db06df7fc7f50d0264e501d37f5911 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Fri, 9 Feb 2024 07:57:01 -0800 Subject: [PATCH 36/36] uncomment --- .buildkite/build_pipeline.yml | 55 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/.buildkite/build_pipeline.yml b/.buildkite/build_pipeline.yml index 5e6ef1c64b6c2..43ff5240baeaf 100644 --- a/.buildkite/build_pipeline.yml +++ b/.buildkite/build_pipeline.yml @@ -1,33 +1,32 @@ steps: - # - input: "Build parameters" - # if: build.source == "ui" - # fields: - # - select: "Rebuild?" - # key: "REBUILD" - # default: "" - # required: false - # options: - # - label: "no" - # value: "" - # - label: "yes" - # value: "rebuild" - # hint: "Should all books be rebuilt, regardless of what has changed? Build once with this set to true after every release." - # - select: "How should broken links be handled?" - # key: "BROKEN_LINKS" - # default: "" - # required: false - # options: - # - label: "Continue without warning" - # value: "skiplinkcheck" - # - label: "Continue, but log a warning" - # value: "warnlinkcheck" - # - label: "Fail the build" - # value: "" - # hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." - # - wait + - input: "Build parameters" + if: build.source == "ui" + fields: + - select: "Rebuild?" + key: "REBUILD" + default: "" + required: false + options: + - label: "no" + value: "" + - label: "yes" + value: "rebuild" + hint: "Should all books be rebuilt, regardless of what has changed? Build once with this set to true after every release." + - select: "How should broken links be handled?" + key: "BROKEN_LINKS" + default: "" + required: false + options: + - label: "Continue without warning" + value: "skiplinkcheck" + - label: "Continue, but log a warning" + value: "warnlinkcheck" + - label: "Fail the build" + value: "" + hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." + - wait - label: "Full rebuild or incremental build?" - # this has to be commented out for testing purposes - #if: build.source == "schedule" + if: build.source == "schedule" command: ".buildkite/scripts/compare_commits.sh" - label: ":white_check_mark: Build docs" command: |