Skip to content

Commit b5499bb

Browse files
committed
Build docker image with hops hadoop distribution
1 parent 4944d54 commit b5499bb

File tree

7 files changed

+82
-34
lines changed

7 files changed

+82
-34
lines changed

Jenkinsfile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
pipeline {
2+
agent {
3+
label "local"
4+
}
5+
environment {
6+
VERSION = readFile "${env.WORKSPACE}/version.txt"
7+
BUILD_BRANCH = readFile "${env.WORKSPACE}/build_branch.txt"
8+
}
9+
stages {
10+
stage("build and publish") {
11+
agent {
12+
label "local"
13+
}
14+
steps {
15+
withCredentials([usernamePassword(credentialsId: 'cred', passwordVariable: 'NEXUS_CREDS_PSW', usernameVariable: 'NEXUS_CREDS_USR')]) {
16+
sh """
17+
set -ex
18+
echo "Building RSS version ${VERSION} on branch ${BUILD_BRANCH}"
19+
docker login -u ${NEXUS_CREDS_USR} -p ${NEXUS_CREDS_PSW} docker.hops.works
20+
git checkout ${BUILD_BRANCH}
21+
./build_distribution.sh --spark3-profile spark3 --hadoop-profile hadoop3.2 --without-dashboard
22+
cd deploy/kubernetes/docker || exit
23+
./build.sh --hadoop-version 3.2.0.13-EE-SNAPSHOT --registry docker.hops.works --nexus-user $NEXUS_CREDS_USR --nexus-password $NEXUS_CREDS_PSW
24+
cd ../../..
25+
26+
mkdir -p /opt/repository/master/rss/${VERSION}/
27+
cp client/target/rss-client-${VERSION}.jar /opt/repository/master/rss/${VERSION}/
28+
"""
29+
}
30+
}
31+
}
32+
}
33+
34+
post {
35+
success {
36+
build job:'Remote shuffle services', parameters: [
37+
string(name: 'image', value: "rss"),
38+
string(name: 'branch', value: "master")
39+
]
40+
}
41+
}
42+
}

build_branch.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
branch-0.9

build_distribution.sh

+2
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ done
122122

123123
cd $RSS_HOME
124124

125+
set +u
125126
if [ -z "$JAVA_HOME" ]; then
126127
echo "Error: JAVA_HOME is not set, cannot proceed."
127128
exit -1
128129
fi
130+
set -u
129131

130132
if [ $(command -v git) ]; then
131133
GITREV=$(git rev-parse --short HEAD 2>/dev/null || :)

deploy/kubernetes/docker/Dockerfile

+7-20
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
#
2-
# Licensed to the Apache Software Foundation (ASF) under one or more
3-
# contributor license agreements. See the NOTICE file distributed with
4-
# this work for additional information regarding copyright ownership.
5-
# The ASF licenses this file to You under the Apache License, Version 2.0
6-
# (the "License"); you may not use this file except in compliance with
7-
# the License. You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS,
13-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License for the specific language governing permissions and
15-
# limitations under the License.
16-
#
1+
# syntax=docker/dockerfile:experimental
172

183
ARG BASE_IMAGE=uniffle-base:latest
194
FROM ${BASE_IMAGE}
@@ -24,6 +9,7 @@ ARG RSS_VERSION
249
ARG AUTHOR=unknown
2510
ARG GIT_BRANCH=unknown
2611
ARG GIT_COMMIT=unknown
12+
ARG HADOOP_FILE=hops-$HADOOP_VERSION.tgz
2713

2814
LABEL author=${AUTHOR}
2915
LABEL git-branch=${GIT_BRANCH}
@@ -44,10 +30,11 @@ COPY rss-env.sh /data/rssadmin/rss/bin
4430

4531
COPY start.sh /data/rssadmin/rss/bin
4632

47-
COPY hadoop-${HADOOP_VERSION}.tar.gz /data/rssadmin
48-
RUN tar -zxvf /data/rssadmin/hadoop-${HADOOP_VERSION}.tar.gz -C /data/rssadmin
49-
RUN mv /data/rssadmin/hadoop-${HADOOP_VERSION} /data/rssadmin/hadoop
50-
RUN rm -rf /data/rssadmin/hadoop-${HADOOP_VERSION}.tar.gz
33+
COPY $HADOOP_FILE /data/rssadmin
34+
RUN mkdir -p /data/rssadmin/hops-${HADOOP_VERSION}
35+
RUN tar -zxvf /data/rssadmin/$HADOOP_FILE --strip-components=1 -C /data/rssadmin/hops-${HADOOP_VERSION}
36+
RUN mv /data/rssadmin/hops-${HADOOP_VERSION} /data/rssadmin/hadoop
37+
RUN rm -rf /data/rssadmin/$HADOOP_FILE
5138
COPY hadoopconfig/ /data/rssadmin/hadoop/etc/hadoop
5239

5340
ENV RSS_VERSION ${RSS_VERSION}

deploy/kubernetes/docker/base/debian/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ ARG BASE_IMAGE=eclipse-temurin:11-jdk
2020
FROM ${BASE_IMAGE}
2121

2222
RUN apt-get update && \
23-
apt-get install -y zlib1g zlib1g-dev lzop lsof netcat dnsutils less procps iputils-ping && \
23+
apt-get install -y zlib1g zlib1g-dev lzop lsof netcat dnsutils less procps iputils-ping curl && \
2424
apt-get clean && rm -rf /var/lib/apt/lists/*

deploy/kubernetes/docker/build.sh

+28-13
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ function exit_with_usage() {
2929
echo "+------------------------------------------------------------------------------------------------------+"
3030
echo "| ./build.sh [--hadoop-version <hadoop version>] [--registry <registry url>] [--author <author name>] |"
3131
echo "| [--base-os-distribution <os distribution>] [--base-image <base image url>] |"
32-
echo "| [--push-image <true|false>] [--apache-mirror <apache mirror url>] |"
32+
echo "| [--push-image <true|false>] [--apache-mirror <apache mirror url>] [--nexus-user <nexus username>]
33+
[--nexus-password <nexus password>] |"
3334
echo "+------------------------------------------------------------------------------------------------------+"
3435
exit 1
3536
}
3637

3738
REGISTRY="docker.io/library"
38-
HADOOP_VERSION=2.8.5
39-
HADOOP_SHORT_VERSION=$(echo $HADOOP_VERSION | awk -F "." '{print $1"."$2}')
39+
HADOOP_VERSION=3.2.0.13-SNAPSHOT
4040
AUTHOR=$(whoami)
4141
# If you are based in China, you could pass --apache-mirror <a_mirror_url> when building this.
4242
APACHE_MIRROR="https://dlcdn.apache.org"
@@ -70,6 +70,14 @@ while (( "$#" )); do
7070
PUSH_IMAGE="$2"
7171
shift
7272
;;
73+
--nexus-user)
74+
NEXUS_USER="$2"
75+
shift
76+
;;
77+
--nexus-password)
78+
NEXUS_PASSWORD="$2"
79+
shift
80+
;;
7381
--help)
7482
exit_with_usage
7583
;;
@@ -92,6 +100,8 @@ while (( "$#" )); do
92100
shift
93101
done
94102

103+
HADOOP_SHORT_VERSION=$(echo $HADOOP_VERSION | awk -F "." '{print $1"."$2}')
104+
95105
if [ -z "$BASE_IMAGE" ]; then
96106
echo "start building base image: uniffle-base"
97107
docker build -t "uniffle-base:latest" \
@@ -101,14 +111,15 @@ else
101111
echo "using base image(${BASE_IMAGE}) to build rss server"
102112
fi
103113

104-
105-
HADOOP_FILE=hadoop-${HADOOP_VERSION}.tar.gz
106-
ARCHIVE_HADOOP_URL=https://archive.apache.org/dist/hadoop/core/hadoop-${HADOOP_VERSION}/${HADOOP_FILE}
107-
HADOOP_URL=${APACHE_MIRROR}/hadoop/core/hadoop-${HADOOP_VERSION}/${HADOOP_FILE}
108-
echo "HADOOP_URL is either ${HADOOP_URL} or ${ARCHIVE_HADOOP_URL}"
109-
if [ ! -e "$HADOOP_FILE" ]; \
110-
then wget "${HADOOP_URL}" || wget "$ARCHIVE_HADOOP_URL"; \
111-
else echo "${HADOOP_FILE} has been downloaded"; \
114+
HADOOP_FILE=hops-$HADOOP_VERSION.tgz
115+
if [ ! -e "$HADOOP_FILE" ]; then
116+
if [[ -n "$NEXUS_USER" ]] && [[ -n "$NEXUS_PASSWORD" ]] ; then
117+
wget --user $NEXUS_USER --password $NEXUS_PASSWORD https://nexus.hops.works/repository/hopshadoop/$HADOOP_FILE
118+
else
119+
wget https://repo.hops.works/master/$HADOOP_FILE
120+
fi
121+
else
122+
echo "${HADOOP_FILE} has been downloaded";
112123
fi
113124

114125
RSS_DIR=../../..
@@ -126,17 +137,21 @@ cp "$RSS_DIR/$RSS_FILE" .
126137

127138
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
128139
GIT_COMMIT=$(git describe --dirty --always --tags | sed 's/-/./g')
129-
echo "image version: ${IMAGE_VERSION:=$RSS_VERSION-$GIT_COMMIT}"
140+
IMAGE_VERSION=$(cat $RSS_DIR/version.txt | awk '{$1=$1; print}' | sed '/^$/d')
130141
IMAGE=$REGISTRY/rss-server:$IMAGE_VERSION
142+
echo "image version: ${IMAGE_VERSION}"
143+
IMAGE=$REGISTRY/rss:$IMAGE_VERSION
131144
echo "building image: $IMAGE"
132-
docker build --network=host -t "$IMAGE" \
145+
146+
DOCKER_BUILDKIT=1 docker build --network=host -t "$IMAGE" \
133147
--build-arg RSS_VERSION="$RSS_VERSION" \
134148
--build-arg HADOOP_VERSION="$HADOOP_VERSION" \
135149
--build-arg HADOOP_SHORT_VERSION="$HADOOP_SHORT_VERSION" \
136150
--build-arg AUTHOR="$AUTHOR" \
137151
--build-arg GIT_COMMIT="$GIT_COMMIT" \
138152
--build-arg GIT_BRANCH="$GIT_BRANCH" \
139153
--build-arg BASE_IMAGE="$BASE_IMAGE" \
154+
--build-arg HADOOP_FILE="$HADOOP_FILE" \
140155
-f Dockerfile --no-cache .
141156

142157
if [ x"${PUSH_IMAGE}" == x"true" ]; then

version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.9.0

0 commit comments

Comments
 (0)