|
1 | 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
|
| 2 | +env: |
| 3 | + DOCKER_REGISTRY: "docker.elastic.co" |
| 4 | + SETUP_GVM_VERSION: 'v0.5.0' # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151 |
| 5 | + SETUP_MAGE_VERSION: '1.14.0' |
| 6 | + # this is required in order to allow the build process to override the default PWD of the BEAT_NAME. |
| 7 | + BEAT_NAME: "elastic-agent" |
| 8 | + # after moving elastic-agent out of beats, we should update the URL of the packaging. |
| 9 | + BEAT_URL: "https://www.elastic.co/elastic-agent" |
2 | 10 |
|
3 | 11 | steps:
|
4 |
| - - label: "Example test" |
5 |
| - command: echo "Hello!" |
| 12 | + - input: "Build parameters" |
| 13 | + if: build.env("ManifestURL") == null |
| 14 | + fields: |
| 15 | + - text: "ManifestURL" |
| 16 | + key: "ManifestURL" |
| 17 | + default: "" |
| 18 | + required: true |
| 19 | + hint: "Link to the build manifest URL." |
| 20 | + - select: "Mage verbose" |
| 21 | + key: "MAGEFILE_VERBOSE" |
| 22 | + required: "false" |
| 23 | + options: |
| 24 | + - label: "True" |
| 25 | + value: "1" |
| 26 | + - label: "False" |
| 27 | + value: "0" |
| 28 | + hint: "Increase verbosity of the mage commands, defaults to 0" |
| 29 | + - select: "DRA Workflow" |
| 30 | + key: "DRA_WORKFLOW" |
| 31 | + required: "true" |
| 32 | + options: |
| 33 | + - label: "snapshot" |
| 34 | + value: "snapshot" |
| 35 | + - label: "staging" |
| 36 | + value: "staging" |
| 37 | + hint: "What workflow of the DRA release process this build is going to be triggered for" |
| 38 | + - text: "DRA Version" |
| 39 | + key: "DRA_VERSION" |
| 40 | + required: "true" |
| 41 | + default: "" |
| 42 | + hint: "The packaging version to use" |
| 43 | + - select: "DRA DRY-RUN" |
| 44 | + key: "DRA_DRY_RUN" |
| 45 | + required: "false" |
| 46 | + options: |
| 47 | + - label: "True" |
| 48 | + value: "--dry-run" |
| 49 | + - label: "False" |
| 50 | + value: "" |
| 51 | + hint: "If the DRA release manager script would actually publish anything or just print" |
| 52 | + |
| 53 | + - wait: ~ |
| 54 | + if: build.env("ManifestURL") == null |
| 55 | + |
| 56 | + - group: ":Packaging Artefacts" |
| 57 | + key: "package" |
| 58 | + steps: |
| 59 | + - label: ":package: Cross Building and package elastic-agent" |
| 60 | + key: package_elastic-agent |
| 61 | + agents: |
| 62 | + provider: "gcp" |
| 63 | + machineType: "c2-standard-16" |
| 64 | + diskSizeGb: 400 |
| 65 | + command: | |
| 66 | + if [[ -z "${ManifestURL}" ]]; then |
| 67 | + export ManifestURL=$(buildkite-agent meta-data get ManifestURL --default "") |
| 68 | + if [[ -z "${ManifestURL}" ]]; then |
| 69 | + echo ":broken_heart: Missing ManifestURL variable or empty string provided" |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + fi |
| 73 | + if [[ -z "${MAGEFILE_VERBOSE}" ]]; then |
| 74 | + export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0") |
| 75 | + fi |
| 76 | + .buildkite/scripts/steps/package.sh |
| 77 | + artifact_paths: |
| 78 | + - "build/distributions/**/*" |
| 79 | + - label: ":package: Package ARM elastic-agent" |
| 80 | + key: package_elastic-agent-arm |
| 81 | + agents: |
| 82 | + provider: "aws" |
| 83 | + instanceType: "t4g.2xlarge" |
| 84 | + imagePrefix: "core-ubuntu-2004-aarch64" |
| 85 | + env: |
| 86 | + PLATFORMS: "linux/arm64" |
| 87 | + PACKAGES: "docker" |
| 88 | + command: | |
| 89 | + if [[ -z "${ManifestURL}" ]]; then |
| 90 | + export ManifestURL=$(buildkite-agent meta-data get ManifestURL --default "") |
| 91 | + if [[ -z "${ManifestURL}" ]]; then |
| 92 | + echo ":broken_heart: Missing ManifestURL variable or empty string provided" |
| 93 | + exit 1 |
| 94 | + fi |
| 95 | + fi |
| 96 | + if [[ -z "${MAGEFILE_VERBOSE}" ]]; then |
| 97 | + export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0") |
| 98 | + fi |
| 99 | + .buildkite/scripts/steps/package.sh |
| 100 | + artifact_paths: |
| 101 | + - "build/distributions/**/*" |
| 102 | + |
| 103 | + - label: ":elastic-stack: Publishing to DRA" |
| 104 | + key: dra-publish |
| 105 | + depends_on: package |
| 106 | + agents: |
| 107 | + provider: "gcp" |
| 108 | + env: |
| 109 | + DRA_PROJECT_ID: "elastic-agent-package" |
| 110 | + DRA_PROJECT_ARTIFACT_ID: "agent-package" |
| 111 | + command: | |
| 112 | + echo "+++ Restoring Artifacts" |
| 113 | + buildkite-agent artifact download "build/**/*" . |
| 114 | + echo "+++ Changing permissions for the release manager" |
| 115 | + sudo chown -R :1000 build/distributions/ |
| 116 | + echo "+++ Running DRA publish step" |
| 117 | + if [[ -z "${MAGEFILE_VERBOSE}" ]]; then |
| 118 | + export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0") |
| 119 | + fi |
| 120 | + if [[ -z "${DRA_DRY_RUN}" ]]; then |
| 121 | + DRA_DRY_RUN=$(buildkite-agent meta-data get DRA_DRY_RUN --default "") |
| 122 | + export DRA_DRY_RUN |
| 123 | + fi |
| 124 | + if [[ -z "${DRA_VERSION}" ]]; then |
| 125 | + DRA_VERSION=$(buildkite-agent meta-data get DRA_VERSION --default "") |
| 126 | + export DRA_VERSION |
| 127 | + fi |
| 128 | + if [[ -z "${DRA_COMMIT}" ]]; then |
| 129 | + DRA_COMMIT=$BUILDKITE_COMMIT |
| 130 | + export DRA_COMMIT |
| 131 | + fi |
| 132 | + if [[ -z "${DRA_BRANCH}" ]]; then |
| 133 | + DRA_BRANCH=$BUILDKITE_BRANCH |
| 134 | + export DRA_BRANCH |
| 135 | + fi |
| 136 | + .buildkite/scripts/steps/dra-publish.sh |
0 commit comments