Skip to content

Commit

Permalink
Test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
terryyylim committed Nov 17, 2020
1 parent 358d8ff commit a181b69
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 22 deletions.
89 changes: 86 additions & 3 deletions .github/workflows/master_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,103 @@ on:
- 'v*.*.*'

jobs:
build-docker-images:
runs-on: [self-hosted]
get-version:
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.get_release_version.outputs.release_version }}
version_without_prefix: ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
highest_semver_tag: ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
steps:
- uses: actions/checkout@v2
- name: Get release version
id: get_release_version
run: echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
- name: Get release version without prefix
id: get_release_version_without_prefix
env:
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
run: |
echo ::set-output name=version_without_prefix::${RELEASE_VERSION:1}
- name: Get highest semver
id: get_highest_semver
env:
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
run: |
source infra/scripts/setup-common-functions.sh
SEMVER_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'
if echo "${RELEASE_VERSION}" | grep -P "$SEMVER_REGEX" &>/dev/null ; then
echo ::set-output name=highest_semver_tag::$(get_tag_release -m)
fi
- name: Check output
env:
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
VERSION_WITHOUT_PREFIX: ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
HIGHEST_SEMVER_TAG: ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
run: |
echo $RELEASE_VERSION
echo $VERSION_WITHOUT_PREFIX
echo $HIGHEST_SEMVER_TAG
build-publish-docker-images:
runs-on: [ubuntu-latest]
needs: get-version
strategy:
matrix:
component: [core, serving, jobservice, jupyter, ci]
component: [core]
env:
MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- 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: Get m2 cache
run: |
infra/scripts/download-maven-cache.sh \
--archive-uri ${MAVEN_CACHE} \
--output-dir .
- name: Build and push versioned images
env:
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: |
echo $RELEASE_VERSION
echo $VERSION_WITHOUT_PREFIX
echo $HIGHEST_SEMVER_TAG
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
echo "is latest tag..."
fi
# build-docker-images:
# runs-on: [self-hosted]
# strategy:
# matrix:
# component: [core, serving, jobservice, jupyter, ci]
# env:
# MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar
# steps:
# - uses: actions/checkout@v2
# - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
# with:
# version: '290.0.1'
# export_default_credentials: true
# - run: gcloud auth configure-docker --quiet
# - name: Get m2 cache
# run: |
# infra/scripts/download-maven-cache.sh \
Expand Down
40 changes: 21 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,29 @@ jobs:
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
HIGHEST_SEMVER_TAG: ${{ needs.get-version.outputs.highest_semver_tag }}
run: |
echo $RELEASE_VERSION
echo $VERSION_WITHOUT_PREFIX
echo $HIGHEST_SEMVER_TAG
# 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} \
# -f infra/docker/${{ matrix.component }}/Dockerfile .
# docker push gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
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 build --build-arg VERSION=$RELEASE_VERSION \
-t feastdev/feast-${{ matrix.component }}:test \
-t feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} \
-t gcr.io/kf-feast/feast-${{ matrix.component }}:test \
-t gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} \
-f infra/docker/${{ matrix.component }}/Dockerfile .
docker push feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
docker push feastdev/feast-${{ matrix.component }}:test
docker push gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
docker push gcr.io/kf-feast/feast-${{ matrix.component }}:test
exit 0
fi
SEMVER_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'
if echo "${RELEASE_VERSION}" | grep -P "$SEMVER_REGEX" &>/dev/null ; then
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} \
-f infra/docker/${{ matrix.component }}/Dockerfile .
docker push gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
echo "is latest tag..."
# docker build --build-arg VERSION=$RELEASE_VERSION \
# -t feastdev/feast-${{ matrix.component }}:test \
# -t feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} \
# -t gcr.io/kf-feast/feast-${{ matrix.component }}:test \
# -t gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} \
# -f infra/docker/${{ matrix.component }}/Dockerfile .
# docker push feastdev/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
# docker push feastdev/feast-${{ matrix.component }}:test
# docker push gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}
# docker push gcr.io/kf-feast/feast-${{ matrix.component }}:test
fi
Expand Down

0 comments on commit a181b69

Please sign in to comment.