Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force package target to download acs file from manifest #38763

Draft
wants to merge 9 commits into
base: 7.17
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,58 +45,58 @@ steps:
- wait: ~
if: build.env("ManifestURL") == null

- group: ":Packaging Artefacts"
key: "package"
steps:
- label: "Package elastic-agent"
key: package_elastic-agent
command: |
if [[ -z "$${ManifestURL}" ]]; then
export ManifestURL=$(buildkite-agent meta-data get ManifestURL --default "")
if [[ -z "$${ManifestURL}" ]]; then
echo ":broken_heart: Missing ManifestURL variable or empty string provided"
echo "Provided ManifestURL: ${ManifestURL}"
exit 1
fi
fi
if [[ -z "$${MAGEFILE_VERBOSE}" ]]; then
export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0")
fi
.buildkite/x-pack/elastic-agent/scripts/steps/package.sh
artifact_paths:
- "x-pack/elastic-agent/build/distributions/**/*"
agents:
provider: "gcp"
image: "family/platform-ingest-beats-ubuntu-2204"
# - group: ":Packaging Artefacts"
# key: "package"
# steps:
# - label: "Package elastic-agent"
# key: package_elastic-agent
# command: |
# if [[ -z "$${ManifestURL}" ]]; then
# export ManifestURL=$(buildkite-agent meta-data get ManifestURL --default "")
# if [[ -z "$${ManifestURL}" ]]; then
# echo ":broken_heart: Missing ManifestURL variable or empty string provided"
# echo "Provided ManifestURL: ${ManifestURL}"
# exit 1
# fi
# fi
# if [[ -z "$${MAGEFILE_VERBOSE}" ]]; then
# export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0")
# fi
# .buildkite/x-pack/elastic-agent/scripts/steps/package.sh
# artifact_paths:
# - "x-pack/elastic-agent/build/distributions/**/*"
# agents:
# provider: "gcp"
# image: "family/platform-ingest-beats-ubuntu-2204"

# - label: "Package ARM elastic-agent"
# env:
# PLATFORMS: "linux/arm64"
# PACKAGES: "docker"
# key: package_elastic-agent-arm
# command: |
# if [[ -z "$${ManifestURL}" ]]; then
# export ManifestURL=$(buildkite-agent meta-data get ManifestURL --default "")
# if [[ -z "$${ManifestURL}" ]]; then
# echo ":broken_heart: Missing ManifestURL variable or empty string provided"
# echo "Provided ManifestURL: ${ManifestURL}"
# exit 1
# fi
# fi
# if [[ -z "$${MAGEFILE_VERBOSE}" ]]; then
# export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0")
# fi
# .buildkite/x-pack/elastic-agent/scripts/steps/package.sh
# artifact_paths:
# - "x-pack/elastic-agent/build/distributions/**/*"
# agents:
# provider: "aws"
# instanceType: "t4g.2xlarge"
# imagePrefix: "platform-ingest-beats-ubuntu-2004-aarch64"

- label: "Package ARM elastic-agent"
env:
PLATFORMS: "linux/arm64"
PACKAGES: "docker"
key: package_elastic-agent-arm
command: |
if [[ -z "$${ManifestURL}" ]]; then
export ManifestURL=$(buildkite-agent meta-data get ManifestURL --default "")
if [[ -z "$${ManifestURL}" ]]; then
echo ":broken_heart: Missing ManifestURL variable or empty string provided"
echo "Provided ManifestURL: ${ManifestURL}"
exit 1
fi
fi
if [[ -z "$${MAGEFILE_VERBOSE}" ]]; then
export MAGEFILE_VERBOSE=$(buildkite-agent meta-data get MAGEFILE_VERBOSE --default "0")
fi
.buildkite/x-pack/elastic-agent/scripts/steps/package.sh
artifact_paths:
- "x-pack/elastic-agent/build/distributions/**/*"
agents:
provider: "aws"
instanceType: "t4g.2xlarge"
imagePrefix: "platform-ingest-beats-ubuntu-2004-aarch64"
#
- label: ":elastic-stack: Publishing to DRA"
key: dra-publish
depends_on: package
# depends_on: package
agents:
provider: "gcp"
env:
Expand All @@ -105,7 +105,7 @@ steps:
command: |
echo "+++ Restoring Artifacts"
mkdir build
buildkite-agent artifact download "x-pack/elastic-agent/build/**/*" .
buildkite-agent artifact download "x-pack/elastic-agent/build/**/*" . --build 018ec2a4-ee3d-4a15-9e64-afbf25039705
echo "+++ Changing permissions for the release manager"
sudo chown -R :1000 x-pack/elastic-agent/build/distributions/
echo "+++ Running DRA publish step"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"

# force main branch on PR's or it won't execute
# because the PR branch does not have a project folder in release-manager
if [[ "${BUILDKITE_PULL_REQUEST:="false"}" != "false" || "$BUILDKITE_BRANCH" == "xpack_agent_core_publish" ]]; then
if [[ "${BUILDKITE_PULL_REQUEST:="false"}" != "false" || "$BUILDKITE_BRANCH" == "acs_filies_quick_fix" ]]; then
BRANCH=7.17
# DRY_RUN="--dry-run"
echo "+++ Running in PR or test branch and setting branch 7.17 and --dry-run"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/x-pack/elastic-agent/scripts/steps/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo "--- Packaging Elastic Agent"

echo $ManifestURL

export AGENT_DROP_PATH=build/elastic-agent-drop
export AGENT_DROP_PATH=build/distributions/elastic-agent-drop
mkdir -p $AGENT_DROP_PATH

mage -v -d x-pack/elastic-agent clean downloadManifest package ironbank fixDRADockerArtifacts
Expand Down
8 changes: 7 additions & 1 deletion dev-tools/mage/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"time"

artifacts "github.com/elastic/beats/v7/dev-tools/mage/artifacts"
Expand Down Expand Up @@ -90,8 +91,13 @@ func resolveManifestPackage(project artifacts.Project, pkg string, reqPackage st
if mg.Verbose() {
log.Printf(">>>>>>>>>>> Project branch/commit [%s, %s]", project.Branch, project.CommitHash)
}
return []string{val.URL, val.ShaURL, val.AscURL}

// Force the asc file to be downloaded even is the acs_url is empty
if len(val.AscURL) == 0 && strings.HasSuffix(val.URL, ".tar.gz") {
return []string{val.URL, val.ShaURL, val.URL + ".asc"}
}

return []string{val.URL, val.ShaURL, val.AscURL}
}

// DownloadComponentsFromManifest is going to download a set of components from the given manifest into the destination
Expand Down
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ func packageAgent(requiredPackages []string, packagingFn func()) {
}

// cleanup after build
defer os.RemoveAll(dropPath)
// defer os.RemoveAll(dropPath)
defer os.Unsetenv(agentDropPath)

packedBeats := []string{"filebeat", "heartbeat", "metricbeat", "osquerybeat"}
Expand Down
Loading