Skip to content

chore: add support for x86_64-unknown-linux-musl releases #654

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

Merged
merged 3 commits into from
Jul 17, 2019
Merged
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
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@ jobs:
- "*-x86_64-unknown-linux-gnu.tar.gz"
- "*-amd64.deb"

build-x86_64-unknown-linux-musl-archive:
docker:
- image: timberiodev/vector-builder-x86_64-unknown-linux-musl:latest
resource_class: xlarge
steps:
- checkout
- run:
name: Build archive
command: |
export VERSION=$(make version)
make build-archive FEATURES="jemallocator"
- persist_to_workspace:
root: target/artifacts
paths:
- "*-x86_64-unknown-linux-musl.tar.gz"
- "*-amd64.deb"

#
# Packaging
#
Expand Down Expand Up @@ -414,6 +431,7 @@ build-requires: &build-requires
package-requires: &package-requires
requires:
- build-x86_64-unknown-linux-gnu-archive
- build-x86_64-unknown-linux-musl-archive
- build-x86_64-apple-darwin-archive

verify-requires: &verify-requires
Expand Down Expand Up @@ -452,6 +470,9 @@ workflows:
- build-x86_64-unknown-linux-gnu-archive:
<<: *release-workflow-filters
<<: *build-requires
- build-x86_64-unknown-linux-musl-archive:
<<: *release-workflow-filters
<<: *build-requires
- build-x86_64-apple-darwin-archive:
<<: *release-workflow-filters
<<: *build-requires
Expand Down
4 changes: 0 additions & 4 deletions .metadata.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1308,10 +1308,6 @@ toml_table = "https://github.com/toml-lang/toml#table"
uuidv4 = "https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)"
vector_repo = "https://github.com/timberio/vector"
vector_initd_service = "https://github.com/timberio/vector/blob/master/distribution/init.d/vector"
vector_edge_x86_64-apple-darwin = "https://packages.timber.io/vector/edge/vector-edge-x86_64-apple-darwin.tar.gz"
vector_latest_x86_64-apple-darwin = "https://packages.timber.io/vector/latest/vector-latest-x86_64-apple-darwin.tar.gz"
vector_edge_x86_64-unknown-linux-gnu = "https://packages.timber.io/vector/edge/vector-edge-x86_64-unknown-linux-gnu.tar.gz"
vector_latest_x86_64-unknown-linux-gnu = "https://packages.timber.io/vector/latest/vector-latest-x86_64-unknown-linux-gnu.tar.gz"
vector_systemd_file = "https://github.com/timberio/vector/blob/master/distribution/systemd/vector.service"
vote_feature = "https://github.com/timberio/vector/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A%22Type%3A+New+Feature%22"
vector_chat = "https://chat.vector.dev"
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ test: ## Spins up Docker resources and runs _every_ test

##@ Releasing

build-archive: FEATURES = "default"
build-archive: ## Build a Vector archive for a given $TARGET and $VERSION
@scripts/build-archive.sh
@FEATURES=$(FEATURES) scripts/build-archive.sh

build-ci-docker-images: ## Build the various Docker images used for CI
@scripts/build-ci-docker-images.sh
Expand Down
4 changes: 3 additions & 1 deletion docs/setup/installation/manual/from-archives.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ architectures. If you don't see an architecture, then we recommend
| :------------| :-----: | :---- |
| [`x86_64-apple-darwin`][url.vector_latest_x86_64-apple-darwin] | `latest` | 64-bit OSX (10.7+, Lion+) |
| [`uknown-linux-gnu`][url.vector_latest_x86_64-unknown-linux-gnu] | `latest` | 64-bit Linux (2.6.18+) |
| [`uknown-linux-musl`][url.vector_latest_x86_64-unknown-linux-musl] | `latest` | 64-bit Linux with MUSL |

{% endtab %}
{% tab title="Edge" %}
Expand All @@ -37,7 +38,8 @@ using them over the "latest" alternatives.
| Architecture | Channel | Notes |
| :------------| :-----: | :---- |
| [`x86_64-apple-darwin`][url.vector_edge_x86_64-apple-darwin] | `edge` | 64-bit OSX (10.7+, Lion+) |
| [`uknown-linux-gnu`][url.vector_edge_x86_64-unknown-linux-gnu] | `latest` | 64-bit Linux (2.6.18+) |
| [`uknown-linux-gnu`][url.vector_edge_x86_64-unknown-linux-gnu] | `edge` | 64-bit Linux (2.6.18+) |
| [`uknown-linux-musl`][url.vector_edge_x86_64-unknown-linux-musl] | `edge` | 64-bit Linux with MUSL |
{% endtab %}
{% endtabs %}

Expand Down
8 changes: 6 additions & 2 deletions scripts/build-archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@

set -eu

echo "Building version $VERSION for target $TARGET"
echo "Building -- version: $VERSION, target: $TARGET, features: $FEATURES"

artifacts_dir="target/artifacts"
target_dir="target/$TARGET"
archive_dir_name="vector-$VERSION"
archive_dir="$target_dir/$archive_dir_name"

cargo build --target $TARGET --release
if [ "$FEATURES" == "default" ]; then
cargo build --target $TARGET --release
else
cargo build --no-default-features --features $FEATURES --target $TARGET --release
fi

# Build the archive directory
rm -rf $archive_dir
Expand Down
1 change: 1 addition & 0 deletions scripts/build-ci-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function extend_cross_base_image() {
# The following images are basic Docker images that do not extend a
# cross base image.
build_image "builder-x86_64-unknown-linux-gnu"
build_image "builder-x86_64-unknown-linux-musl"
build_image "checker"
build_image "packager-deb"
build_image "packager-rpm"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,20 @@
FROM japaric/x86_64-unknown-linux-musl:latest

# Install the git repository to ensure we get the latest version.
# This is important for determining the current Vector version number.
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:git-core/ppa

RUN echo "deb http://dk.archive.ubuntu.com/ubuntu/ trusty main universe
deb http://dk.archive.ubuntu.com/ubuntu/ trusty-updates main universe" | > /etc/apt/sources.list.d/fury.list

RUN apt-get update

# Note: We do not call `apt-get upgrade` because we do not want Vector to
# depend on newer versions of libraries. This is just an assumption,
# I could be completely wrong with how this works.

RUN apt-get install -y --no-install-recommends \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
g++-4.4 \
gcc-4.4 \
git \
openssh-server \
vim \
libleveldb-dev \
libsnappy-dev

RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 50

RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
RUN update-alternatives --set cc /usr/bin/gcc

RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
RUN update-alternatives --set c++ /usr/bin/g++

# Note: We do not compile or install leveldb or rdkafka libraries because
# those Rust creates automatically build and link the libraries for
# this target. Unfortunately, this is not the case for other targets,
# hence the reason we only support this target currently.
zlib1g-dev

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
ENV PATH="$PATH:/root/.cargo/bin"
RUN cargo install cargo-deb
ENV TARGET=x86_64-unknown-linux-musl
RUN rustup target add x86_64-unknown-linux-musl
5 changes: 5 additions & 0 deletions scripts/generate/metadata/links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ def parse(full_name)
label = "#{type.titleize}: #{name}"
VECTOR_ISSUES_ROOT + "/new?" + {"labels" => [label]}.to_query

when /^url\.vector_(edge|latest)_(.*)/
channel = $1
target = $2
"https://packages.timber.io/vector/#{channel}/vector-#{channel}-#{target}.tar.gz"

when /^url\.(.*)_test$/
name = $1
"#{TEST_HARNESS_ROOT}/tree/master/cases/#{name}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/package-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export RELEASE=1
export CLEANED_VERSION=$VERSION
CLEANED_VERSION=$(echo $CLEANED_VERSION | sed 's/-/\./g')

# The arch is the first part of the part
# The arch is the first part of the target
ARCH=$(echo $TARGET | cut -d'-' -f1)

# Create source dir
Expand Down
10 changes: 8 additions & 2 deletions scripts/release-s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if [ -z "$CHANNEL" ]; then
exit 1
fi

escaped_version=$(echo $VERSION | sed "s/\./\\\./g")

#
# S3
Expand All @@ -34,19 +35,24 @@ aws s3 cp "target/artifacts/" "s3://packages.timber.io/vector/$VERSION/" --recur
echo "Uploading all artifacts to s3://packages.timber.io/vector/edge/"
td=$(mktemp -d)
cp -a "target/artifacts/." "$td"
escaped_version=$(echo $VERSION | sed "s/\./\\\./g")
rename -v "s/$escaped_version/edge/" "$td/*"
echo "Renamed all builds: via \"s/$escaped_version/edge/\""
ls $td
aws s3 rm --recursive "s3://packages.timber.io/vector/edge/"
aws s3 cp "$td" "s3://packages.timber.io/vector/edge/" --recursive
rm -rf $td
echo "Uploaded edge archives"

if [[ "$CHANNEL" == "latest" ]]; then
# Update the "latest" files
echo "Uploading all artifacts to s3://packages.timber.io/vector/latest/"
td=$(mktemp -d)
cp -a "target/artifacts/." "$td"
rename -v "s/edge/latest/" "$td/*"
rename -v "s/$escaped_version/latest/" "$td/*"
echo "Renamed all builds: via \"s/$escaped_version/latest/\""
ls $td
aws s3 rm --recursive "s3://packages.timber.io/vector/latest/"
aws s3 cp "$td" "s3://packages.timber.io/vector/latest/" --recursive
rm -rf $td
echo "Uploaded latest archives"
fi