Skip to content

Commit

Permalink
Test new pipeline to publish packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm committed Apr 26, 2024
1 parent d13e474 commit 4ed5702
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ steps:
memory: "8G"
env:
ARTIFACTS_FOLDER: "artifacts-to-sign"
DRY_RUN: "true"
DRY_RUN: "${DRY_RUN}"
depends_on:
- step: "check"
allow_failure: false
Expand Down
113 changes: 61 additions & 52 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,57 +29,66 @@ steps:
cpu: "8"
memory: "4G"

- label: ":package: Build packages"
key: "build-packages"
command: ".buildkite/scripts/build_packages.sh"
agents:
image: "${LINUX_AGENT_IMAGE}"
cpu: "8"
memory: "8G"
env:
ARTIFACTS_FOLDER: "artifacts-to-sign"
DRY_RUN: "false"
depends_on:
- step: "check"
allow_failure: false
artifact_paths:
- artifacts-to-sign/*.zip

- label: "Trigger integrations"
key: "test-integrations"
command: ".buildkite/scripts/trigger_integrations_in_parallel.sh"
env:
UPLOAD_SAFE_LOGS: 1
depends_on:
- step: "check"
allow_failure: false

- wait: ~
continue_on_failure: true

- label: "Publish benchmarks"
key: publish-benchmarks
command: ".buildkite/scripts/process_benchmarks.sh"
env:
BENCHMARK_THRESHOLD: 15
agents:
image: "${LINUX_AGENT_IMAGE}"
cpu: "8"
memory: "4G"
# - label: ":package: Build packages"
# key: "build-packages"
# command: ".buildkite/scripts/build_packages.sh"
# agents:
# image: "${LINUX_AGENT_IMAGE}"
# cpu: "8"
# memory: "8G"
# env:
# ARTIFACTS_FOLDER: "artifacts-to-sign"
# DRY_RUN: "false"
# depends_on:
# - step: "check"
# allow_failure: false
# artifact_paths:
# - artifacts-to-sign/*.zip
- label: ":package: test pipeline"
key: test-build-package
trigger: "integrations-publish"
build:
env:
DRY_RUN: "true"
BUILDKITE_REFSPEC: "refs/pull/${BUILDKITE_PULL_REQUEST}/merge"
BUILDKITE_COMMIT: "${BUILDKITE_COMMIT}"

- label: ":sonarqube: Continuous Code Inspection"
env:
VAULT_SONAR_TOKEN_PATH: "kv/ci-shared/platform-ingest/elastic/integrations/sonar-analyze-token"
agents:
image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest"
command: ".buildkite/scripts/run_sonar_scanner.sh"
artifact_paths:
- build/test-coverage/coverage_merged.xml

- label: ":junit: Junit annotate"
plugins:
- junit-annotate#v2.4.1:
artifacts: "build/test-results/*.xml"
failed-download-exit-code: 0 # Not fail the build in case there are no XML files
agents:
provider: "gcp" # junit plugin requires docker
# - label: "Trigger integrations"
# key: "test-integrations"
# command: ".buildkite/scripts/trigger_integrations_in_parallel.sh"
# env:
# UPLOAD_SAFE_LOGS: 1
# depends_on:
# - step: "check"
# allow_failure: false
#
# - wait: ~
# continue_on_failure: true
#
# - label: "Publish benchmarks"
# key: publish-benchmarks
# command: ".buildkite/scripts/process_benchmarks.sh"
# env:
# BENCHMARK_THRESHOLD: 15
# agents:
# image: "${LINUX_AGENT_IMAGE}"
# cpu: "8"
# memory: "4G"
#
# - label: ":sonarqube: Continuous Code Inspection"
# env:
# VAULT_SONAR_TOKEN_PATH: "kv/ci-shared/platform-ingest/elastic/integrations/sonar-analyze-token"
# agents:
# image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest"
# command: ".buildkite/scripts/run_sonar_scanner.sh"
# artifact_paths:
# - build/test-coverage/coverage_merged.xml
#
# - label: ":junit: Junit annotate"
# plugins:
# - junit-annotate#v2.4.1:
# artifacts: "build/test-results/*.xml"
# failed-download-exit-code: 0 # Not fail the build in case there are no XML files
# agents:
# provider: "gcp" # junit plugin requires docker
13 changes: 8 additions & 5 deletions .buildkite/scripts/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ build_packages() {

local package_zip="${name}-${version}.zip"

if [[ "${package_zip}" != "elastic_package_registry-0.2.0" ]]; then
if is_already_published "${package_zip}" ; then
echo "Skipping. ${package_zip} already published"
popd > /dev/null
continue
fi
fi

echo "Build package as zip: ${package}"
if check_and_build_package "${package}" ; then
Expand Down Expand Up @@ -97,6 +99,7 @@ with_yq
with_go
use_elastic_package

echo "--- Testing on PR"
echo "--- Build packages"

if [[ "$BUILDKITE_RETRY_COUNT" != "0" ]]; then
Expand All @@ -115,10 +118,10 @@ cd "${WORKSPACE}" || exit 1
mkdir -p "${ARTIFACTS_FOLDER}"
cp "${BUILD_PACKAGES_FOLDER}"/*.zip "${ARTIFACTS_FOLDER}"/

if [ "${DRY_RUN}" == "true" ]; then
echo "DRY_RUN enabled. Publish packages steps skipped."
exit 0
fi
# if [ "${DRY_RUN}" == "true" ]; then
# echo "DRY_RUN enabled. Publish packages steps skipped."
# exit 0
# fi

# triggering dynamically the steps for signing and publishing
# allow us to check whether or not this group of steps needs to be run in one script
Expand Down Expand Up @@ -148,7 +151,7 @@ steps:
env:
SIGNING_STEP_KEY: "sign-service"
ARTIFACTS_FOLDER: "packageArtifacts"
DRY_RUN: "${DRY_RUN}"
DRY_RUN: "true"
agents:
image: "${LINUX_AGENT_IMAGE}"
cpu: "8"
Expand Down

0 comments on commit 4ed5702

Please sign in to comment.