From 2fd14969ad1cc622f49dbb0a9ab5ef8c26677b8b Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:19:15 -0400 Subject: [PATCH] [8.14] ci: integrate observability deployments with the oblt-test-env (#181041) (#181451) # Backport This will backport the following commits from `main` to `8.14`: - [ci: integrate observability deployments with the oblt-test-env (#181041)](https://github.com/elastic/kibana/pull/181041) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Victor Martinez --- .../steps/serverless/build_and_deploy.sh | 35 ++++++++++++++++++- .github/workflows/deploy-my-kibana.yml | 4 +-- .github/workflows/oblt-github-commands.yml | 1 - 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/steps/serverless/build_and_deploy.sh b/.buildkite/scripts/steps/serverless/build_and_deploy.sh index c346bf11a3ada..77c0cd6a92584 100644 --- a/.buildkite/scripts/steps/serverless/build_and_deploy.sh +++ b/.buildkite/scripts/steps/serverless/build_and_deploy.sh @@ -137,8 +137,41 @@ EOF buildkite-agent meta-data set pr_comment:early_comment_job_id "$BUILDKITE_JOB_ID" } +# This is the integration with the observability-test-environments +create_github_issue_oblt_test_environments() { + +echo "--- Create GitHub issue for deploying in the oblt test env" + +GITHUB_ISSUE=$(mktemp --suffix ".md") +cat < "$GITHUB_ISSUE" +### Kibana image + +$KIBANA_IMAGE + +### Kibana pull request + +$BUILDKITE_PULL_REQUEST + +### Further details + +Caused by @$GITHUB_PR_TRIGGER_USER using the github label in https://github.com/elastic/kibana/pull/$BUILDKITE_PULL_REQUEST +EOF + + GH_TOKEN="$GITHUB_TOKEN" \ + gh issue create \ + --title "[Deploy Serverless Kibana] for user $GITHUB_PR_TRIGGER_USER with PR kibana@pr-$BUILDKITE_PULL_REQUEST" \ + --body-file "${GITHUB_ISSUE}" \ + --label 'deploy-custom-kibana-serverless' \ + --repo 'elastic/observability-test-environments' \ + --assignee "$GITHUB_PR_OWNER" +} + is_pr_with_label "ci:project-deploy-elasticsearch" && deploy "elasticsearch" -is_pr_with_label "ci:project-deploy-observability" && deploy "observability" +if is_pr_with_label "ci:project-deploy-observability" ; then + create_github_issue_oblt_test_environments + echo "--- Deploy observability with Kibana CI" + deploy "observability" +fi is_pr_with_label "ci:project-deploy-security" && deploy "security" exit 0; diff --git a/.github/workflows/deploy-my-kibana.yml b/.github/workflows/deploy-my-kibana.yml index d1f7d993bf7b4..4eac490b2c0a7 100644 --- a/.github/workflows/deploy-my-kibana.yml +++ b/.github/workflows/deploy-my-kibana.yml @@ -20,7 +20,7 @@ permissions: jobs: deploy-my-kibana: - if: ${{ github.event.issue.pull_request && (github.event.comment.body == '/oblt-deploy' || github.event.comment.body == '/oblt-deploy-serverless') }} + if: ${{ github.event.issue.pull_request && github.event.comment.body == '/oblt-deploy' }} runs-on: ubuntu-latest steps: - uses: elastic/apm-pipeline-library/.github/actions/deploy-my-kibana@current @@ -28,4 +28,4 @@ jobs: vaultUrl: ${{ secrets.OBLT_VAULT_ADDR }} vaultRoleId: ${{ secrets.OBLT_VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.OBLT_VAULT_SECRET_ID }} - serverless: ${{ github.event.comment.body == '/oblt-deploy-serverless' }} + serverless: false diff --git a/.github/workflows/oblt-github-commands.yml b/.github/workflows/oblt-github-commands.yml index f6d095766ccac..4388901e2fa0e 100644 --- a/.github/workflows/oblt-github-commands.yml +++ b/.github/workflows/oblt-github-commands.yml @@ -50,7 +50,6 @@ jobs: Just comment with: - \`/oblt-deploy\` : Deploy a Kibana instance using the Observability test environments. - - \`/oblt-deploy-serverless\` : Deploy a serverless Kibana instance using the Observability test environments. - \`run\` \`elasticsearch-ci/docs\` : Re-trigger the docs validation. (use unformatted text in the comment!)