Skip to content

Commit

Permalink
[CI] Temporarly fix adoptopenjdk8 failure
Browse files Browse the repository at this point in the history
Summary:
This is a workaround for the adoptopenjdk8 issue:
adoptium/infrastructure#1399

It should help keeping the CI running until this is fixed upstream.
The real solution would be to update to latest Teamcity, which will cut
the dependency to the old Java 8 version.

Test Plan: Run any CI build.

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D6635
  • Loading branch information
Fabcien committed Jun 18, 2020
1 parent 2c9b8b6 commit 8b9c76a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 8 deletions.
54 changes: 54 additions & 0 deletions contrib/teamcity/install_openjdk8.sh
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

export LC_ALL=C.UTF-8

set -euxo pipefail

ADOPTOPENJDK_APT_REPOSITORY=https://adoptopenjdk.jfrog.io/adoptopenjdk/deb
ADOPTOPENJDK8_DEB_FILE=adoptopenjdk-8-hotspot_8u252-b09-2_amd64.deb

ADOPTOPENJDK8_DEPENDENCIES=(
java-common
libasound2
libc6
libx11-6
libxext6
libxi6
libxrender1
libxtst6
zlib1g
)

function join_by() {
local IFS="$1"
shift
echo "$*"
}

# First install the known dependencies
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${ADOPTOPENJDK8_DEPENDENCIES[@]}")

apt-key add "$(dirname $0)/adoptopenjdk.pub"

{
# Try to install from the repo
add-apt-repository --yes "${ADOPTOPENJDK_APT_REPOSITORY}" &&
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get install -y adoptopenjdk-8-hotspot
} || {
# Fallback in case of failure:
# - Remove the faulty repo, make sure we can update the packages
# - Download the deb package and install it using dpkg
add-apt-repository -r "${ADOPTOPENJDK_APT_REPOSITORY}" &&
apt-get update &&
wget "${ADOPTOPENJDK_APT_REPOSITORY}/pool/main/a/adoptopenjdk-8-hotspot/${ADOPTOPENJDK8_DEB_FILE}" &&
dpkg -i "${ADOPTOPENJDK8_DEB_FILE}"
} || {
# Nothing worked, give up
echo "Unable to install adoptopenjdk8, giving up"
exit 1
}

ln -s /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64 /usr/lib/jvm/default-java
echo 'JAVA_HOME="/usr/lib/jvm/default-java"' >> /etc/environment
11 changes: 3 additions & 8 deletions contrib/teamcity/setup-debian-buster.sh
Expand Up @@ -79,14 +79,9 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${PACKAGES[@]}"

TEAMCITY_DIR=$(dirname "$0")

# Add the AdoptOpenJDK repo
apt-key add "${TEAMCITY_DIR}"/adoptopenjdk.pub
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y adoptopenjdk-8-hotspot

ln -s /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64 /usr/lib/jvm/default-java
echo 'JAVA_HOME="/usr/lib/jvm/default-java"' >> /etc/environment
# FIXME this should no longer be needed starting with Teamcity 2020.1, which
# supports Java 11.
"${TEAMCITY_DIR}/install_openjdk8.sh"

# Install llvm-8 and clang-10
apt-key add "${TEAMCITY_DIR}"/llvm.pub
Expand Down

0 comments on commit 8b9c76a

Please sign in to comment.