Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .buildkite/scripts/run-installer-compliance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ function start_stack() {
local elastic_package="go run github.com/elastic/elastic-package"

cd compliance
$elastic_package stack up -d --version $stack_version
$elastic_package stack up -d --version "$stack_version"
eval $($elastic_package stack shellinit)
cd -
}

echo "--- Start local Elastic Stack $STACK_VERSION with elastic-package"
start_stack $STACK_VERSION
start_stack "$STACK_VERSION"

echo "--- Check compliance with Package Spec $SPEC_VERSION"
TEST_SPEC_VERSION=$SPEC_VERSION TEST_SPEC_JUNIT=report-$STACK_VERSION-$SPEC_VERSION.xml make -C compliance test
TEST_SPEC_VERSION="$SPEC_VERSION" TEST_SPEC_JUNIT="report-$STACK_VERSION-$SPEC_VERSION.xml" make -C compliance test
23 changes: 19 additions & 4 deletions .buildkite/scripts/test-with-integrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,20 @@ clone_repository() {
retry 5 git clone https://github.com/elastic/integrations "${target}"
}

# This function retrieves the assignees for the pull request.
# It checks if the head user is not "elastic" or the trigger user, and adds it to the list of assignees.
# It returns a comma-separated list of assignees.
get_assignees() {
local assignees="${GITHUB_PR_TRIGGER_USER}"
if [[ "${GITHUB_PR_HEAD_USER}" != "elastic" && "${GITHUB_PR_HEAD_USER}" != "${GITHUB_PR_TRIGGER_USER}" ]]; then
assignees="${assignees},${GITHUB_PR_HEAD_USER}"
fi
echo "${assignees}"
}

create_integrations_pull_request() {
local assignees=""
assignees=$(get_assignees)
# requires GITHUB_TOKEN
local temp_path
temp_path=$(mktemp -d -p "${WORKSPACE}" -t "${TMP_FOLDER_TEMPLATE}")
Expand All @@ -83,7 +96,7 @@ create_integrations_pull_request() {
--draft \
--base "${INTEGRATIONS_SOURCE_BRANCH}" \
--head "${INTEGRATIONS_PR_BRANCH}" \
--assignee "${GITHUB_PR_HEAD_USER}"
--assignee "${assignees}"
}

update_dependency() {
Expand All @@ -95,7 +108,7 @@ update_dependency() {
local source_dep="github.com/${GITHUB_PR_BASE_OWNER}/${GITHUB_PR_BASE_REPO}${VERSION_DEP}"
local target_dep="github.com/${GITHUB_PR_OWNER}/${GITHUB_PR_REPO}${VERSION_DEP}@${GITHUB_PR_HEAD_SHA}"

go mod edit -replace ${source_dep}=${target_dep}
go mod edit -replace "${source_dep}=${target_dep}"
go mod tidy

git add go.mod
Expand All @@ -112,7 +125,6 @@ update_dependency() {
echo ""
}


exists_branch() {
local owner="$1"
local repository="$2"
Expand Down Expand Up @@ -173,7 +185,6 @@ create_or_update_pull_request() {
add_pr_comment "${BUILDKITE_PULL_REQUEST}" "$(get_integrations_pr_link "${integrations_pr_number}")"
}


add_pr_comment() {
local source_pr_number="$1"
local integrations_pr_link="$2"
Expand All @@ -184,6 +195,10 @@ add_pr_comment() {
--repo "${GITHUB_PR_BASE_OWNER}/${GITHUB_PR_BASE_REPO}"
}

if [[ "${BUILDKITE_PULL_REQUEST}" == "false" ]]; then
echo "Currently, this pipeline is just supported in Pull Requests."
exit 1
fi

echo "--- creating or updating integrations pull request"
create_or_update_pull_request