Skip to content

Commit

Permalink
Rename ManifestUrl env variable to MANIFEST_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
pchila committed Apr 12, 2024
1 parent bc25f47 commit d12dcff
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
24 changes: 12 additions & 12 deletions .buildkite/pipeline.elastic-agent-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ env:

steps:
- input: "Build parameters"
if: build.env("ManifestURL") == null
if: build.env("MANIFEST_URL") == null
fields:
- text: "ManifestURL"
key: "ManifestURL"
- text: "MANIFEST_URL"
key: "MANIFEST_URL"
default: ""
required: true
hint: "Link to the build manifest URL."
Expand Down Expand Up @@ -51,7 +51,7 @@ steps:
hint: "If the DRA release manager script would actually publish anything or just print"

- wait: ~
if: build.env("ManifestURL") == null
if: build.env("MANIFEST_URL") == null

- group: ":Packaging Artefacts"
key: "package"
Expand All @@ -63,10 +63,10 @@ steps:
machineType: "c2-standard-16"
diskSizeGb: 400
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"
if [[ -z "${MANIFEST_URL}" ]]; then
export MANIFEST_URL=$(buildkite-agent meta-data get MANIFEST_URL --default "")
if [[ -z "${MANIFEST_URL}" ]]; then
echo ":broken_heart: Missing MANIFEST_URL variable or empty string provided"
exit 1
fi
fi
Expand All @@ -86,10 +86,10 @@ steps:
PLATFORMS: "linux/arm64"
PACKAGES: "docker"
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"
if [[ -z "${MANIFEST_URL}" ]]; then
export MANIFEST_URL=$(buildkite-agent meta-data get MANIFEST_URL --default "")
if [[ -z "${MANIFEST_URL}" ]]; then
echo ":broken_heart: Missing MANIFEST_URL variable or empty string provided"
exit 1
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions .buildkite/scripts/steps/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -euo pipefail
_SELF=$(dirname $0)
source "${_SELF}/../common.sh"

if test -z "${ManifestURL=:""}"; then
echo "Missing variable ManifestURL, export it before use."
if test -z "${MANIFEST_URL=:""}"; then
echo "Missing variable MANIFEST_URL, export it before use."
exit 2
fi

Expand All @@ -17,7 +17,7 @@ mkdir -p $AGENT_DROP_PATH
mage clean downloadManifest package ironbank fixDRADockerArtifacts

echo "+++ Generate dependencies report"
BEAT_VERSION_FULL=$(curl -s -XGET "${ManifestURL}" |jq '.version' -r )
BEAT_VERSION_FULL=$(curl -s -XGET "${MANIFEST_URL}" |jq '.version' -r )
bash "${_SELF}/../../../dev-tools/dependencies-report"
mkdir -p build/distributions/reports
mv dependencies.csv "build/distributions/reports/dependencies-${BEAT_VERSION_FULL}.csv"
4 changes: 3 additions & 1 deletion dev-tools/mage/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const (
// Env vars
// agent package version
agentPackageVersionEnvVar = "AGENT_PACKAGE_VERSION"
//ManifestUrlEnvVar is the name fo the environment variable containing the Manifest URL to be used for packaging agent
ManifestUrlEnvVar = "MANIFEST_URL"

// Mapped functions
agentPackageVersionMappedFunc = "agent_package_version"
Expand Down Expand Up @@ -152,7 +154,7 @@ func initGlobals() {

agentPackageVersion = EnvOr(agentPackageVersionEnvVar, "")

ManifestURL = EnvOr("ManifestURL", "")
ManifestURL = EnvOr(ManifestUrlEnvVar, "")
PackagingFromManifest = ManifestURL != ""
}

Expand Down
2 changes: 1 addition & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var Aliases = map[string]interface{}{
"build": Build.All,
"demo": Demo.Enroll,
}
var errNoManifest = errors.New("missing ManifestURL environment variable")
var errNoManifest = errors.New(fmt.Sprintf("missing %q environment variable", mage.ManifestUrlEnvVar))
var errNoAgentDropPath = errors.New("missing AGENT_DROP_PATH environment variable")
var errAtLeastOnePlatform = errors.New("elastic-agent package is expected to build at least one platform package")

Expand Down

0 comments on commit d12dcff

Please sign in to comment.