summaryrefslogtreecommitdiffstats
path: root/taskcluster/docker/system-symbols-linux-scraper
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--taskcluster/docker/system-symbols-linux-scraper/Dockerfile28
-rw-r--r--taskcluster/docker/system-symbols-linux-scraper/SHA256SUMS.txt6
-rwxr-xr-xtaskcluster/docker/system-symbols-linux-scraper/run.sh80
3 files changed, 114 insertions, 0 deletions
diff --git a/taskcluster/docker/system-symbols-linux-scraper/Dockerfile b/taskcluster/docker/system-symbols-linux-scraper/Dockerfile
new file mode 100644
index 0000000000..1b2c340ff0
--- /dev/null
+++ b/taskcluster/docker/system-symbols-linux-scraper/Dockerfile
@@ -0,0 +1,28 @@
+FROM $DOCKER_IMAGE_PARENT
+MAINTAINER Gabriele Svelto <gsvelto@mozilla.com>
+
+RUN mkdir -p /builds
+RUN id worker || useradd -d /builds/worker -s /bin/bash -m worker
+WORKDIR /builds/worker
+
+# We need to declare all potentially cache volumes as caches. Also,
+# making high I/O paths volumes increase I/O throughput because of
+# AUFS slowness.
+VOLUME /builds/worker/checkouts
+
+RUN apt-get update && \
+ apt-get install --no-install-recommends -y \
+ binutils build-essential cpio curl elfutils jq libxml2-utils \
+ python3-pip rpm2cpio squashfs-tools unzip wget zip && \
+ apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
+
+COPY run.sh /builds/worker/run.sh
+
+COPY SHA256SUMS.txt /builds/worker/
+
+RUN chown -R worker:worker /builds/worker
+
+RUN pip3 install crashstats-tools==1.3.0
+
+# Set a default command useful for debugging
+CMD ["/bin/bash", "--login"]
diff --git a/taskcluster/docker/system-symbols-linux-scraper/SHA256SUMS.txt b/taskcluster/docker/system-symbols-linux-scraper/SHA256SUMS.txt
new file mode 100644
index 0000000000..46a456d21a
--- /dev/null
+++ b/taskcluster/docker/system-symbols-linux-scraper/SHA256SUMS.txt
@@ -0,0 +1,6 @@
+b4ba66e218aa6f27e19bfbc48142f86f3fddb64b6540fd5beb30bad11f73a409 arch/SHA256SUMS.zip
+6083ab8cb46a5be2a4d9bc51dce1443375f71d9536c325da39a14ba68c1de81a debian/SHA256SUMS.zip
+64003a50133900e5d01b29e37022b3029652788a0e094b67330e5e32f1bf5e12 fedora/SHA256SUMS.zip
+00e3e54788b2d7867535eb25bc9ce41541dc6299dca0a8ce8d0d4e5b49839ac3 mint/SHA256SUMS.zip
+c4d02cc24f2a50b0caea20dd5fd0cd6bc960d0a619e8a355f7fec14a766e7966 opensuse/SHA256SUMS.zip
+aed77c596f5652f4ecdc48b37aaa1c2b0b516c7e74ccc0cf183e7d7de101b6d7 ubuntu/SHA256SUMS.zip
diff --git a/taskcluster/docker/system-symbols-linux-scraper/run.sh b/taskcluster/docker/system-symbols-linux-scraper/run.sh
new file mode 100755
index 0000000000..d7837d112e
--- /dev/null
+++ b/taskcluster/docker/system-symbols-linux-scraper/run.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+set -ex
+
+SHA256SUMS=SHA256SUMS.zip
+
+function get_route()
+{
+ local task_url=${TASKCLUSTER_ROOT_URL}/api/queue/v1/task/${TASK_ID}
+ local payload
+ payload=$(curl -sSL "${task_url}")
+
+ local route
+ route=$(echo "${payload}" | jq -r '.routes[] | select(contains("latest")) | select(contains("pushdate") | not) ' | sed -e 's/^index\.//')
+ echo "${route}"
+}
+
+function get_sha256sum_url()
+{
+ local route
+ route=$(get_route)
+ local sha256sums_url=${TASKCLUSTER_ROOT_URL}/api/index/v1/task/${route}/artifacts/public/build/${SHA256SUMS}
+ echo "${sha256sums_url}"
+}
+
+function has_sha256sums_on_index()
+{
+ local url
+ url=$(get_sha256sum_url)
+ curl -sSL --head --fail -o /dev/null "${url}"
+}
+
+function download_verify_extract_sha256sums()
+{
+ local url=$1
+
+ if [ ! -f "/builds/worker/SHA256SUMS.txt" ]; then
+ echo "Missing checksums, aborting."
+ exit 1
+ fi
+
+ curl -sSL "${url}" -o ${SHA256SUMS}
+
+ # We verify SHA256SUMS when we bootstrap and thus download from GitHub
+ # The one downloaded from TaskCluster will have been updated by previous tasks
+ if [ -n "${BOOTSTRAP_SHA256}" ]; then
+ echo "BOOTSTRAP_SHA256 was set, ensuring consistent set of SHA256SUMS"
+ local sha_check
+ sha256sum --quiet --status -c <(grep "${DISTRO}/" /builds/worker/SHA256SUMS.txt | sed -e "s/${DISTRO}\///")
+ sha_check=$?
+ if [ ${sha_check} -ne 0 ]; then
+ echo "Checksum verification failed, aborting."
+ exit 1
+ fi
+ fi
+
+ unzip ${SHA256SUMS} && rm ${SHA256SUMS}
+}
+
+DISTRO=$1
+
+sha256=https://mozilla.github.io/symbol-scrapers/${DISTRO}/${SHA256SUMS}
+if [ -z "${BOOTSTRAP_SHA256}" ]; then
+ if has_sha256sums_on_index; then
+ sha256=$(get_sha256sum_url)
+ fi
+fi
+
+mkdir -p /builds/worker/artifacts/
+
+pushd "${MOZ_FETCHES_DIR}/symbol-scrapers/${DISTRO}"
+ download_verify_extract_sha256sums "${sha256}"
+ DUMP_SYMS=${MOZ_FETCHES_DIR}/dump_syms/dump_syms /bin/bash script.sh
+ zip -r9 /builds/worker/artifacts/${SHA256SUMS} SHA256SUMS
+ cp wget*.log /builds/worker/artifacts/
+popd
+
+if [ ! -f "/builds/worker/artifacts/target.crashreporter-symbols.zip" ]; then
+ echo "No symbols zip produced, upload task will fail"
+fi