From 0277331abf711c77f171c2be6f435b371d44d9b5 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 14 Oct 2024 18:35:17 -0500 Subject: [PATCH 1/3] [ci] Fix yarn-offline-mirror Currently CI is configuring a yarn offline mirror outside of the Kibana directory, with the intention of caching assets during image build. This configuration is ignored due to .yarnrc taking precedence, resulting in the offline mirror being setup in the local Kibana installation. On CI start, a fresh checkout of the repository is made and the cache directory is empty. Instead of setting a user level configuration this modifies .yarnrc with the intended directory. --- .buildkite/scripts/common/setup_node.sh | 3 ++- .buildkite/scripts/common/util.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/common/setup_node.sh b/.buildkite/scripts/common/setup_node.sh index c6fbfeaee51bc..661c0ba19846b 100755 --- a/.buildkite/scripts/common/setup_node.sh +++ b/.buildkite/scripts/common/setup_node.sh @@ -77,7 +77,8 @@ if [[ ! $(which yarn) || $(yarn --version) != "$YARN_VERSION" ]]; then npm_install_global yarn "^$YARN_VERSION" fi -yarn config set yarn-offline-mirror "$YARN_OFFLINE_CACHE" +grep -q 'yarn-offline-mirror ".yarn-local-mirror"' .yarnrc +sed -i "s#.yarn-local-mirror#$YARN_OFFLINE_CACHE#" .yarnrc YARN_GLOBAL_BIN=$(yarn global bin) export YARN_GLOBAL_BIN diff --git a/.buildkite/scripts/common/util.sh b/.buildkite/scripts/common/util.sh index 924fedde3ea3b..1335a22a353e0 100755 --- a/.buildkite/scripts/common/util.sh +++ b/.buildkite/scripts/common/util.sh @@ -56,7 +56,7 @@ check_for_changed_files() { git config --global user.name kibanamachine git config --global user.email '42973632+kibanamachine@users.noreply.github.com' gh pr checkout "${BUILDKITE_PULL_REQUEST}" - git add -A -- . ':!.bazelrc' ':!WORKSPACE.bazel' ':!config/node.options' ':!config/kibana.yml' + git add -A -- . ':!.bazelrc' '!.yarnrc' ':!WORKSPACE.bazel' ':!config/node.options' ':!config/kibana.yml' git commit -m "$NEW_COMMIT_MESSAGE" git push From 587fee45383720088de8482cf2ef8d0d070691b6 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 14 Oct 2024 19:18:13 -0500 Subject: [PATCH 2/3] fix changed files --- .buildkite/scripts/common/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/common/util.sh b/.buildkite/scripts/common/util.sh index 1335a22a353e0..266f5441572dc 100755 --- a/.buildkite/scripts/common/util.sh +++ b/.buildkite/scripts/common/util.sh @@ -33,7 +33,7 @@ check_for_changed_files() { SHOULD_AUTO_COMMIT_CHANGES="${2:-}" CUSTOM_FIX_MESSAGE="${3:-}" - GIT_CHANGES="$(git status --porcelain -- . ':!:.bazelrc' ':!:config/node.options' ':!config/kibana.yml')" + GIT_CHANGES="$(git status --porcelain -- . ':!:.bazelrc' '!.yarnrc' ':!:config/node.options' ':!config/kibana.yml')" if [ "$GIT_CHANGES" ]; then if ! is_auto_commit_disabled && [[ "$SHOULD_AUTO_COMMIT_CHANGES" == "true" && "${BUILDKITE_PULL_REQUEST:-false}" != "false" ]]; then From 15eb14e214b29626c630c609291b0cfd673a883a Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 14 Oct 2024 19:31:20 -0500 Subject: [PATCH 3/3] formatting --- .buildkite/scripts/common/util.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/common/util.sh b/.buildkite/scripts/common/util.sh index 266f5441572dc..90a32b1814885 100755 --- a/.buildkite/scripts/common/util.sh +++ b/.buildkite/scripts/common/util.sh @@ -33,7 +33,7 @@ check_for_changed_files() { SHOULD_AUTO_COMMIT_CHANGES="${2:-}" CUSTOM_FIX_MESSAGE="${3:-}" - GIT_CHANGES="$(git status --porcelain -- . ':!:.bazelrc' '!.yarnrc' ':!:config/node.options' ':!config/kibana.yml')" + GIT_CHANGES="$(git status --porcelain -- . ':!:.bazelrc' ':!:.yarnrc' ':!:config/node.options' ':!config/kibana.yml')" if [ "$GIT_CHANGES" ]; then if ! is_auto_commit_disabled && [[ "$SHOULD_AUTO_COMMIT_CHANGES" == "true" && "${BUILDKITE_PULL_REQUEST:-false}" != "false" ]]; then @@ -56,7 +56,7 @@ check_for_changed_files() { git config --global user.name kibanamachine git config --global user.email '42973632+kibanamachine@users.noreply.github.com' gh pr checkout "${BUILDKITE_PULL_REQUEST}" - git add -A -- . ':!.bazelrc' '!.yarnrc' ':!WORKSPACE.bazel' ':!config/node.options' ':!config/kibana.yml' + git add -A -- . ':!.bazelrc' ':!.yarnrc' ':!WORKSPACE.bazel' ':!config/node.options' ':!config/kibana.yml' git commit -m "$NEW_COMMIT_MESSAGE" git push