Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Trav poc wrong artifacts #7780

Merged
merged 9 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 6 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
13 changes: 2 additions & 11 deletions .cicd/package-builder.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail

if [[ $(uname) == 'Darwin' ]]; then
echo 'Darwin family detected, building for brew.'
[[ -z $ARTIFACT ]] && ARTIFACT='*.rb;*.tar.gz'
Expand Down Expand Up @@ -37,14 +38,4 @@ BASE_COMMIT="${BASE_COMMIT:2:42}"
echo "Found build against $BASE_COMMIT."
cd build/packages
chmod 755 ./*.sh
./generate_package.sh $PACKAGE_TYPE
[[ -d x86_64 ]] && cd 'x86_64' # backwards-compatibility with release/1.6.x
buildkite-agent artifact upload "./$ARTIFACT" --agent-access-token $BUILDKITE_AGENT_ACCESS_TOKEN
for A in $(echo $ARTIFACT | tr ';' ' '); do
if [[ $(ls $A | grep -c '') == 0 ]]; then
echo "+++ :no_entry: ERROR: Expected artifact \"$A\" not found!"
pwd
ls -la
exit 1
fi
done
./generate_package.sh $PACKAGE_TYPE
64 changes: 64 additions & 0 deletions .cicd/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
set -eo pipefail
. ./.cicd/helpers/general.sh

mkdir -p $BUILD_DIR

PRE_COMMANDS="cd $MOUNTED_DIR"
PACKAGE_COMMANDS="./.cicd/package-builder.sh"
COMMANDS="$PRE_COMMANDS && $PACKAGE_COMMANDS"

if [[ $(uname) == 'Darwin' ]]; then

# You can't use chained commands in execute
bash -c "$PACKAGE_COMMANDS"

ARTIFACT='*.rb;*.tar.gz'
cd build/packages
[[ -d x86_64 ]] && cd 'x86_64' # backwards-compatibility with release/1.6.x
buildkite-agent artifact upload "./$ARTIFACT" --agent-access-token $BUILDKITE_AGENT_ACCESS_TOKEN
for A in $(echo $ARTIFACT | tr ';' ' '); do
if [[ $(ls $A | grep -c '') == 0 ]]; then
echo "+++ :no_entry: ERROR: Expected artifact \"$A\" not found!"
pwd
ls -la
exit 1
fi
done

else # Linux

ARGS=${ARGS:-"--rm --init -v $(pwd):$MOUNTED_DIR"}

. $HELPERS_DIR/docker-hash.sh

# Load BUILDKITE Environment Variables for use in docker run
if [[ -f $BUILDKITE_ENV_FILE ]]; then
evars=""
while read -r var; do
evars="$evars --env ${var%%=*}"
done < "$BUILDKITE_ENV_FILE"
fi

eval docker run $ARGS $evars $FULL_TAG bash -c \"$COMMANDS\"

if [[ "$IMAGE_TAG" =~ "ubuntu" ]]; then
echo 'Uploading DEB.'
ARTIFACT='*.deb'
elif [[ "$IMAGE_TAG" =~ "centos" ]]; then
echo 'Uploading RPM'
ARTIFACT='*.rpm'
fi
cd build/packages
[[ -d x86_64 ]] && cd 'x86_64' # backwards-compatibility with release/1.6.x
buildkite-agent artifact upload "./$ARTIFACT" --agent-access-token $BUILDKITE_AGENT_ACCESS_TOKEN
for A in $(echo $ARTIFACT | tr ';' ' '); do
if [[ $(ls $A | grep -c '') == 0 ]]; then
echo "+++ :no_entry: ERROR: Expected artifact \"$A\" not found!"
pwd
ls -la
exit 1
fi
done

fi
11 changes: 7 additions & 4 deletions .cicd/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ steps:
- label: ":centos: CentOS 7.6 - Package Builder"
command:
- "buildkite-agent artifact download build.tar.gz . --step ':centos: CentOS 7.6 - Build' --agent-access-token $$BUILDKITE_AGENT_ACCESS_TOKEN && tar -xzf build.tar.gz"
- "./.cicd/package-builder.sh"
- "./.cicd/package.sh"
env:
IMAGE_TAG: "centos-7.6"
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
Expand All @@ -256,8 +257,9 @@ steps:
- label: ":ubuntu: Ubuntu 16.04 - Package Builder"
command:
- "buildkite-agent artifact download build.tar.gz . --step ':ubuntu: Ubuntu 16.04 - Build' --agent-access-token $$BUILDKITE_AGENT_ACCESS_TOKEN && tar -xzf build.tar.gz"
- "./.cicd/package-builder.sh"
- "./.cicd/package.sh"
env:
IMAGE_TAG: "ubuntu-16.04"
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
Expand All @@ -267,8 +269,9 @@ steps:
- label: ":ubuntu: Ubuntu 18.04 - Package Builder"
command:
- "buildkite-agent artifact download build.tar.gz . --step ':ubuntu: Ubuntu 18.04 - Build' --agent-access-token $$BUILDKITE_AGENT_ACCESS_TOKEN && tar -xzf build.tar.gz"
- "./.cicd/package-builder.sh"
- "./.cicd/package.sh"
env:
IMAGE_TAG: "ubuntu-18.04"
BUILDKITE_AGENT_ACCESS_TOKEN:
agents:
queue: "automation-eos-builder-fleet"
Expand All @@ -279,7 +282,7 @@ steps:
command:
- "git clone $BUILDKITE_REPO eos && cd eos && git checkout $BUILDKITE_COMMIT"
- "cd eos && buildkite-agent artifact download build.tar.gz . --step ':darwin: macOS 10.14 - Build' && tar -xzf build.tar.gz"
- "cd eos && ./.cicd/package-builder.sh"
- "cd eos && ./.cicd/package.sh"
plugins:
- chef/anka#v0.5.1:
no-volume: true
Expand Down