Skip to content

Commit

Permalink
Fix docker build for java parts (#2059)
Browse files Browse the repository at this point in the history
Signed-off-by: pyalex <[email protected]>
  • Loading branch information
pyalex authored Nov 18, 2021
1 parent 8426ca5 commit 8f370a0
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 144 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/java_master_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
component: [core, serving]
component: [feature-server-java]
env:
MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar
REGISTRY: gcr.io/kf-feast
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -34,14 +35,14 @@ jobs:
- name: Get version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build image
run: make build-${{ matrix.component }}-docker REGISTRY=gcr.io/kf-feast VERSION=${GITHUB_SHA}
run: make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${GITHUB_SHA}
- name: Push image
run: make push-${{ matrix.component }}-docker REGISTRY=gcr.io/kf-feast VERSION=${GITHUB_SHA}
run: make push-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${GITHUB_SHA}
- name: Push development Docker image
run: |
if [ ${GITHUB_REF#refs/*/} == "master" ]; then
docker tag gcr.io/kf-feast/feast-${{ matrix.component }}:${GITHUB_SHA} gcr.io/kf-feast/feast-${{ matrix.component }}:develop
docker push gcr.io/kf-feast/feast-${{ matrix.component }}:develop
docker tag ${REGISTRY}/${{ matrix.component }}:${GITHUB_SHA} ${REGISTRY}/${{ matrix.component }}:develop
docker push ${REGISTRY}/${{ matrix.component }}:develop
fi
lint-java:
Expand Down
51 changes: 11 additions & 40 deletions .github/workflows/java_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ jobs:
echo $HIGHEST_SEMVER_TAG
build-publish-docker-images:
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
needs: get-version
strategy:
matrix:
component: [core, serving]
component: [feature-server]
env:
MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar
REGISTRY: feastdev
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -81,27 +82,21 @@ jobs:
RELEASE_VERSION: ${{ needs.get-version.outputs.release_version }}
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
HIGHEST_SEMVER_TAG: ${{ needs.get-version.outputs.highest_semver_tag }}
run: |
docker build --build-arg VERSION=$RELEASE_VERSION \
-t gcr.io/kf-feast/feast-${{ matrix.component }}:${GITHUB_SHA} \
-t gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} \
-t feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} \
-f infra/docker/${{ matrix.component }}/Dockerfile .
docker push gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
docker push feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
- name: Build image
run: make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${RELEASE_VERSION}
- name: Push image
run: make push-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${RELEASE_VERSION}
- run: |
echo "Only push to latest tag if tag is the highest semver version $HIGHEST_SEMVER_TAG"
if [ "${VERSION_WITHOUT_PREFIX}" = "${HIGHEST_SEMVER_TAG:1}" ]
then
docker tag feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} feastdev/feast-${{ matrix.component }}:latest
docker tag gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} gcr.io/kf-feast/feast-${{ matrix.component }}:latest
docker push feastdev/feast-${{ matrix.component }}:latest
docker push gcr.io/kf-feast/feast-${{ matrix.component }}:latest
docker tag ${REGISTRY}/${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} ${REGISTRY}/${{ matrix.component }}:latest
docker push ${REGISTRY}/${{ matrix.component }}:latest
fi
publish-java-sdk:
container: maven:3.6-jdk-11
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
needs: get-version
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -135,27 +130,3 @@ jobs:
mkdir -p /root/.m2/
echo -n "$MAVEN_SETTINGS" > /root/.m2/settings.xml
infra/scripts/publish-java-sdk.sh --revision ${VERSION_WITHOUT_PREFIX} --gpg-key-import-dir /root
publish-helm-charts:
runs-on: ubuntu-latest
needs: get-version
env:
HELM_VERSION: v2.17.0
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
export_default_credentials: true
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- run: gcloud auth configure-docker --quiet
- name: Remove previous Helm
run: sudo rm -rf $(which helm)
- name: Install Helm
run: ./infra/scripts/install-helm.sh
- name: Validate all version consistency
run: ./infra/scripts/validate-helm-chart-versions.sh $VERSION_WITHOUT_PREFIX
- name: Publish Helm charts
run: ./infra/scripts/push-helm-charts.sh $VERSION_WITHOUT_PREFIX
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,17 @@ build-sphinx: compile-protos-python
cd $(ROOT_DIR)/sdk/python/docs && $(MAKE) build-api-source

build-templates:
python infra/scripts/compile-templates.py
python infra/scripts/compile-templates.py


# Java Docker

build-push-java-docker:
@$(MAKE) build-feature-server-java-docker registry=$(REGISTRY) version=$(VERSION)
@$(MAKE) push-feature-server-java-docker registry=$(REGISTRY) version=$(VERSION)

push-feature-server-java-docker:
docker push $(REGISTRY)/feature-server-java:$(VERSION)

build-feature-server-java-docker:
docker build --build-arg VERSION=$(VERSION) -t $(REGISTRY)/feature-server-java:$(VERSION) -f java/infra/docker/feature-server/Dockerfile .
77 changes: 0 additions & 77 deletions java/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ FROM maven:3.6-jdk-11 as builder

WORKDIR /build

COPY pom.xml .
COPY datatypes/java/pom.xml datatypes/java/pom.xml
COPY common/pom.xml common/pom.xml
COPY core/pom.xml core/pom.xml
COPY serving/pom.xml serving/pom.xml
COPY storage/api/pom.xml storage/api/pom.xml
COPY storage/connectors/pom.xml storage/connectors/pom.xml
COPY storage/connectors/redis/pom.xml storage/connectors/redis/pom.xml
COPY sdk/java/pom.xml sdk/java/pom.xml
COPY docs/coverage/java/pom.xml docs/coverage/java/pom.xml
COPY deps/feast/protos/ deps/feast/protos/
COPY java/pom.xml .
COPY java/datatypes/java/pom.xml datatypes/java/pom.xml
COPY java/common/pom.xml common/pom.xml
COPY java/serving/pom.xml serving/pom.xml
COPY java/storage/api/pom.xml storage/api/pom.xml
COPY java/storage/connectors/pom.xml storage/connectors/pom.xml
COPY java/storage/connectors/redis/pom.xml storage/connectors/redis/pom.xml
COPY java/sdk/java/pom.xml sdk/java/pom.xml
COPY java/docs/coverage/java/pom.xml docs/coverage/java/pom.xml

# Setting Maven repository .m2 directory relative to /build folder gives the
# user to optionally use cached repository when building the image by copying
# the existing .m2 directory to $FEAST_REPO_ROOT/.m2
ENV MAVEN_OPTS="-Dmaven.repo.local=/build/.m2/repository -DdependencyLocationsEnabled=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3"
COPY pom.xml .m2/* .m2/
COPY java/pom.xml .m2/* .m2/
RUN mvn dependency:go-offline -DexcludeGroupIds:dev.feast 2>/dev/null || true

COPY . .
COPY java/ .
COPY protos/feast datatypes/java/src/main/proto/feast
COPY protos/tensorflow_metadata datatypes/java/src/main/proto/tensorflow_metadata

ARG VERSION=dev
RUN mvn --also-make --projects serving -Drevision=$VERSION \
Expand Down
File renamed without changes.
15 changes: 7 additions & 8 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</modules>

<properties>
<revision>0.26.2</revision>
<revision>0.15.2-SNAPSHOT</revision>
<github.url>https://github.com/feast-dev/feast</github.url>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -103,16 +103,16 @@
</properties>

<organization>
<name>Gojek</name>
<url>https://www.gojek.com</url>
<name>Tecton</name>
<url>https://www.tecton.ai</url>
</organization>

<developers>
<developer>
<name>Feast Authors</name>
<url>${github.url}</url>
<organization>Gojek</organization>
<organizationUrl>https://www.gojek.com</organizationUrl>
<organization>Tecton</organization>
<organizationUrl>https://www.tecton.ai</organizationUrl>
</developer>
</developers>

Expand Down Expand Up @@ -565,8 +565,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Our leaf applications target 11, except Ingestion and its deps remain on 8 for Beam -->
<release>8</release>
<release>11</release>
<annotationProcessorPaths>
<path>
<groupId>com.google.auto.value</groupId>
Expand Down Expand Up @@ -648,7 +647,7 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.5.2</version>
<version>5.6.3</version>
</dependency>
</dependencies>
</plugin>
Expand Down

0 comments on commit 8f370a0

Please sign in to comment.