Skip to content

Commit

Permalink
Update DSE image build to use compiled Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 committed Sep 23, 2022
1 parent 146120d commit 9107ed0
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 90 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push'}}
needs: build-dse
runs-on: ubuntu-latest
strategy:
matrix:
jdk-version: [jdk8, jdk11]
steps:
- name: Check out source code
uses: actions/checkout@v2
Expand Down Expand Up @@ -161,7 +164,7 @@ jobs:
uses: docker/metadata-action@v3
with:
images: datastax/dse-mgmtapi-6_8
tags: type=sha,prefix=dse68-
tags: type=sha,prefix=dse68-${{ matrix.jdk-version }}-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
Expand All @@ -173,8 +176,8 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
file: dse-68/Dockerfile.jdk11
context: dse-68
file: dse-68/Dockerfile.${{ matrix.jdk-version }}
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/docker-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
strategy:
fail-fast: false
matrix:
cassandra-version: [6.8.26]
dse-version: [6.8.25, 6.8.26]
image-base: [jdk8, jdk11]
include:
- cassandra-version: 6.8.26
- dse-version: 6.8.26
latest: true
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -48,51 +48,51 @@ jobs:
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- if: ${{ matrix.latest }} && ${{ matrix.image-base }} == 'jdk8'
name: Publish ${{ matrix.cassandra-version }} to Registry
name: Publish ${{ matrix.dse-version }} (${{ matrix.image-base }}) to Registry
run: |
RELEASE_VERSION="${GITHUB_REF##*/}"
docker buildx build --push \
--build-arg CASSANDRA_VERSION=${{ matrix.cassandra-version }} \
--build-arg DSE_VERSION=${{ matrix.dse-version }} \
--tag datastax/dse-mgmtapi-6_8:6.8 \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }}-$RELEASE_VERSION \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }}-$RELEASE_VERSION \
--file dse-68/Dockerfile.${{ matrix.image-base }} }} \
--target dse68 \
--platform linux/amd64 ./dse-68
--platform linux/amd64 .
- if: ${{ matrix.latest }} && ${{ matrix.image-base }} != 'jdk8'
name: Publish ${{ matrix.cassandra-version }} to Registry
name: Publish ${{ matrix.dse-version }} (${{ matrix.image-base }}) to Registry
run: |
RELEASE_VERSION="${GITHUB_REF##*/}"
docker buildx build --push \
--build-arg CASSANDRA_VERSION=${{ matrix.cassandra-version }} \
--build-arg DSE_VERSION=${{ matrix.dse-version }} \
--tag datastax/dse-mgmtapi-6_8:6.8-${{ matrix.image-base }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }}-${{ matrix.image-base }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }}-${{ matrix.image-base }}-$RELEASE_VERSION \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }}-${{ matrix.image-base }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }}-${{ matrix.image-base }}-$RELEASE_VERSION \
--file dse-68/Dockerfile.${{ matrix.image-base }} }} \
--target dse68 \
--platform linux/amd64 ./dse-68
--platform linux/amd64 .
- if: ${{ !matrix.latest }} && ${{ matrix.image-base }} == 'jdk8'
name: Publish ${{ matrix.cassandra-version }} to Registry
name: Publish ${{ matrix.dse-version }} (${{ matrix.image-base }}) to Registry
run: |
RELEASE_VERSION="${GITHUB_REF##*/}"
docker buildx build --push \
--build-arg CASSANDRA_VERSION=${{ matrix.cassandra-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }}-$RELEASE_VERSION \
--build-arg DSE_VERSION=${{ matrix.dse-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }}-$RELEASE_VERSION \
--file dse-68/Dockerfile.${{ matrix.image-base }} }} \
--target dse68 \
--platform linux/amd64 ./dse-68
--platform linux/amd64 .
- if: ${{ !matrix.latest }} && ${{ matrix.image-base }} != 'jdk8'
name: Publish ${{ matrix.cassandra-version }} to Registry
name: Publish ${{ matrix.cassandra-version }} (${{ matrix.image-base }}) to Registry
run: |
RELEASE_VERSION="${GITHUB_REF##*/}"
docker buildx build --push \
--build-arg CASSANDRA_VERSION=${{ matrix.cassandra-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }}-${{ matrix.image-base }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.cassandra-version }}-${{ matrix.image-base }}-$RELEASE_VERSION \
--build-arg DSE_VERSION=${{ matrix.dse-version }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }}-${{ matrix.image-base }} \
--tag datastax/dse-mgmtapi-6_8:${{ matrix.dse-version }}-${{ matrix.image-base }}-$RELEASE_VERSION \
--file dse-68/Dockerfile.${{ matrix.image-base }} }} \
--target dse68 \
--platform linux/amd64 ./dse-68
--platform linux/amd64 .
build-oss-3-11x:
strategy:
Expand Down
86 changes: 60 additions & 26 deletions dse-68/Dockerfile.jdk11
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ ENV DSE_HOME /opt/dse
ENV DSE_AGENT_HOME /opt/agent

# Get commandline parameters
ARG VERSION=6.8.26
ARG DSE_VERSION=6.8.26
ARG URL_PREFIX=https://downloads.datastax.com/enterprise
ARG TARBALL=dse-${VERSION}-bin.tar.gz
ARG TARBALL=dse-${DSE_VERSION}-bin.tar.gz
ARG DOWNLOAD_URL=${URL_PREFIX}/${TARBALL}

ARG DSE_AGENT_VERSION=6.8.19
ARG DSE_AGENT_TARBALL=datastax-agent-${DSE_AGENT_VERSION}.tar.gz
ARG DSE_AGENT_DOWNLOAD_URL=${URL_PREFIX}/${DSE_AGENT_TARBALL}

COPY /* /
COPY dse-68/* /

RUN set -x \
# Download DSE tarball if needed
Expand All @@ -40,35 +40,69 @@ RUN set -x \

#############################################################

# The commented section below is what would be used to bundle the Management API
# released artifacts into the DSE image. Since images built in this project are
# being used to test the artifacts, we want to build them from source and embed
# them into the image

FROM debian:buster as mgmtapi-setup
#FROM debian:buster as mgmtapi-setup
#
#WORKDIR /
#
#ENV MAAC_PATH /opt/management-api
#ENV DSE_HOME /opt/dse
#
#ENV MGMTAPI_V=v0.1.45
#
#RUN \
# set -x \
# && apt-get update -y \
# && apt-get install -y wget unzip \
# && mkdir $MAAC_PATH \
# && mkdir $DSE_HOME \
# && mkdir /tmp/mgmtapi-jars \
# && cd /tmp/mgmtapi-jars \
# && wget -q "https://github.com/datastax/management-api-for-apache-cassandra/releases/download/$MGMTAPI_V/jars.zip" \
# && unzip jars.zip \
# && rm jars.zip \
# && find /tmp/mgmtapi-jars -name '*.jar' -type f -exec mv -t $MAAC_PATH -i '{}' + \
# && rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
# && rm $MAAC_PATH/datastax-mgmtapi-agent-4* \
# && cd /tmp \
# && rm -rf /tmp/mgmtapi-jars \
# && echo DONE

FROM --platform=$BUILDPLATFORM maven:3.6.3-jdk-8-slim as mgmtapi-setup

WORKDIR /

ENV MAAC_PATH /opt/management-api
ENV DSE_HOME /opt/dse

ENV MGMTAPI_V=v0.1.45

RUN \
set -x \
&& apt-get update -y \
&& apt-get install -y wget unzip \
&& mkdir $MAAC_PATH \
&& mkdir $DSE_HOME \
&& mkdir /tmp/mgmtapi-jars \
&& cd /tmp/mgmtapi-jars \
&& wget -q "https://github.com/datastax/management-api-for-apache-cassandra/releases/download/$MGMTAPI_V/jars.zip" \
&& unzip jars.zip \
&& rm jars.zip \
&& find /tmp/mgmtapi-jars -name '*.jar' -type f -exec mv -t $MAAC_PATH -i '{}' + \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-4* \
&& cd /tmp \
&& rm -rf /tmp/mgmtapi-jars \
&& echo DONE


COPY pom.xml /tmp/pom.xml
COPY management-api-agent-common/pom.xml /tmp/management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml /tmp/management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml /tmp/management-api-agent-4.x/pom.xml
COPY management-api-agent-dse-6.8/pom.xml tmp/management-api-agent-dse-6.8/pom.xml
COPY management-api-common/pom.xml /tmp/management-api-common/pom.xml
COPY management-api-server/pom.xml /tmp/management-api-server/pom.xml
COPY settings.xml settings.xml /root/.m2/
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN cd /tmp && mvn -q -ff -T 1C install -DskipOpenApi -P dse && rm -rf target

COPY management-api-agent-common /tmp/management-api-agent-common
COPY management-api-agent-3.x /tmp/management-api-agent-3.x
COPY management-api-agent-4.x /tmp/management-api-agent-4.x
COPY management-api-agent-dse-6.8 /tmp/management-api-agent-dse-6.8
COPY management-api-common /tmp/management-api-common
COPY management-api-server /tmp/management-api-server
RUN mkdir $MAAC_PATH \
&& cd /tmp \
&& mvn -q -ff package -DskipTests -P dse \
&& find /tmp -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-4*
#############################################################

FROM datastax/${DS_BASE_DEBIAN}:${BASETAG} AS dse68
Expand All @@ -93,7 +127,7 @@ RUN set -x \
&& groupadd -r dse --gid=999 \
&& useradd -m -d "$DSE_HOME" -r -g dse -G root --uid=999 dse

COPY files /
COPY dse-68/files /

COPY --chown=dse:dse --from=dse-server-prep $DSE_HOME $DSE_HOME
COPY --chown=dse:dse --from=dse-server-prep $DSE_AGENT_HOME $DSE_AGENT_HOME
Expand Down
86 changes: 60 additions & 26 deletions dse-68/Dockerfile.jdk8
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ ENV DSE_HOME /opt/dse
ENV DSE_AGENT_HOME /opt/agent

# Get commandline parameters
ARG VERSION=6.8.26
ARG DSE_VERSION=6.8.26
ARG URL_PREFIX=https://downloads.datastax.com/enterprise
ARG TARBALL=dse-${VERSION}-bin.tar.gz
ARG TARBALL=dse-${DSE_VERSION}-bin.tar.gz
ARG DOWNLOAD_URL=${URL_PREFIX}/${TARBALL}

ARG DSE_AGENT_VERSION=6.8.19
ARG DSE_AGENT_TARBALL=datastax-agent-${DSE_AGENT_VERSION}.tar.gz
ARG DSE_AGENT_DOWNLOAD_URL=${URL_PREFIX}/${DSE_AGENT_TARBALL}

COPY /* /
COPY dse-68/* /

RUN set -x \
# Download DSE tarball if needed
Expand All @@ -40,35 +40,69 @@ RUN set -x \

#############################################################

# The commented section below is what would be used to bundle the Management API
# released artifacts into the DSE image. Since images built in this project are
# being used to test the artifacts, we want to build them from source and embed
# them into the image

FROM debian:buster as mgmtapi-setup
#FROM debian:buster as mgmtapi-setup
#
#WORKDIR /
#
#ENV MAAC_PATH /opt/management-api
#ENV DSE_HOME /opt/dse
#
#ENV MGMTAPI_V=v0.1.45
#
#RUN \
# set -x \
# && apt-get update -y \
# && apt-get install -y wget unzip \
# && mkdir $MAAC_PATH \
# && mkdir $DSE_HOME \
# && mkdir /tmp/mgmtapi-jars \
# && cd /tmp/mgmtapi-jars \
# && wget -q "https://github.com/datastax/management-api-for-apache-cassandra/releases/download/$MGMTAPI_V/jars.zip" \
# && unzip jars.zip \
# && rm jars.zip \
# && find /tmp/mgmtapi-jars -name '*.jar' -type f -exec mv -t $MAAC_PATH -i '{}' + \
# && rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
# && rm $MAAC_PATH/datastax-mgmtapi-agent-4* \
# && cd /tmp \
# && rm -rf /tmp/mgmtapi-jars \
# && echo DONE

FROM --platform=$BUILDPLATFORM maven:3.6.3-jdk-8-slim as mgmtapi-setup

WORKDIR /

ENV MAAC_PATH /opt/management-api
ENV DSE_HOME /opt/dse

ENV MGMTAPI_V=v0.1.45

RUN \
set -x \
&& apt-get update -y \
&& apt-get install -y wget unzip \
&& mkdir $MAAC_PATH \
&& mkdir $DSE_HOME \
&& mkdir /tmp/mgmtapi-jars \
&& cd /tmp/mgmtapi-jars \
&& wget -q "https://github.com/datastax/management-api-for-apache-cassandra/releases/download/$MGMTAPI_V/jars.zip" \
&& unzip jars.zip \
&& rm jars.zip \
&& find /tmp/mgmtapi-jars -name '*.jar' -type f -exec mv -t $MAAC_PATH -i '{}' + \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-4* \
&& cd /tmp \
&& rm -rf /tmp/mgmtapi-jars \
&& echo DONE


COPY pom.xml /tmp/pom.xml
COPY management-api-agent-common/pom.xml /tmp/management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml /tmp/management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml /tmp/management-api-agent-4.x/pom.xml
COPY management-api-agent-dse-6.8/pom.xml tmp/management-api-agent-dse-6.8/pom.xml
COPY management-api-common/pom.xml /tmp/management-api-common/pom.xml
COPY management-api-server/pom.xml /tmp/management-api-server/pom.xml
COPY settings.xml settings.xml /root/.m2/
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN cd /tmp && mvn -q -ff -T 1C install -DskipOpenApi -P dse && rm -rf target

COPY management-api-agent-common /tmp/management-api-agent-common
COPY management-api-agent-3.x /tmp/management-api-agent-3.x
COPY management-api-agent-4.x /tmp/management-api-agent-4.x
COPY management-api-agent-dse-6.8 /tmp/management-api-agent-dse-6.8
COPY management-api-common /tmp/management-api-common
COPY management-api-server /tmp/management-api-server
RUN mkdir $MAAC_PATH \
&& cd /tmp \
&& mvn -q -ff package -DskipTests -P dse \
&& find /tmp -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-4*
#############################################################

FROM datastax/${DS_BASE_DEBIAN}:${BASETAG} AS dse68
Expand All @@ -93,7 +127,7 @@ RUN set -x \
&& groupadd -r dse --gid=999 \
&& useradd -m -d "$DSE_HOME" -r -g dse -G root --uid=999 dse

COPY files /
COPY dse-68/files /

COPY --chown=dse:dse --from=dse-server-prep $DSE_HOME $DSE_HOME
COPY --chown=dse:dse --from=dse-server-prep $DSE_AGENT_HOME $DSE_AGENT_HOME
Expand Down
18 changes: 10 additions & 8 deletions management-api-agent-dse-6.8/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Management API with DSE

It is important to note that all DSE dependencies should only be specified in the DSE shim project(s). No DSE dependencies
must be added to any other projects, as otherwise users won't be able to build the Management API.
It is important to note that all DSE dependencies should only be specified in the DSE agent module. No DSE dependencies
can be added to any other projects/modules, as users without access to DSE artifacts won't be able to build the OSSManagement API.

## Building DSE locally and publishing the Jars
## Building the Management API with DSE

A special `dse` profile was created when building the Management API with DSE dependencies. The required maven command is as following:

```
./gradlew jar publishToMavenLocal -Pversion=6.8.2 -PbuildType=SNAPSHOT
mvn package -P dse
```

## Building the Management API with DSE
## Running tests for the DSE Agent

A special `dse` profile was created when building the Management API with DSE dependencies. The required maven command is as following:
To run the project tests against DSE, you need to enable the `dse` profile and specify the property to run DSE tests as follows:

```
mvn package -P dse
```
mvn verify -P dse -DrunDSEtests
```
Loading

0 comments on commit 9107ed0

Please sign in to comment.