Skip to content

Commit

Permalink
prep test of docker image tags
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Nov 8, 2023
1 parent 0877441 commit 9d3e01b
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 130 deletions.
146 changes: 81 additions & 65 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ on:
dockerhub-username:
required: true
type: string
# this workflow publishes a rocksdb & goleveldb docker image.
# it publishes the following tags:
# - <commit-hash>-goleveldb
# - <extra-image-tag>-goleveldb
# - <commit-hash>-rocksdb
# - <extra-image-tag>-rocksdb
extra-image-tag:
required: true
type: string
secrets:
CI_DOCKERHUB_TOKEN:
required: true
Expand All @@ -14,81 +23,88 @@ on:
# you can use images built by this action in future jobs.
# https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs
jobs:
docker-goleveldb:
# https://github.com/marketplace/actions/build-and-push-docker-images
test-image-tag:
runs-on: ubuntu-latest
steps:
# ensure working with latest code
- name: Checkout
uses: actions/checkout@v4
- name: Output tag we would deploy
env:
IMAGE_TAGS: kava/kava:${{ steps.commit-hash.outputs.short }}-goleveldb,kava/kava:${{ inputs.extra-image-tag }}-goleveldb
run: echo $IMAGE_TAGS
# docker-goleveldb:
# # https://github.com/marketplace/actions/build-and-push-docker-images
# runs-on: ubuntu-latest
# steps:
# # ensure working with latest code
# - name: Checkout
# uses: actions/checkout@v4

# generate a git commit hash to be used as image tag
- name: Generate short hash
id: commit-hash
run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
# # generate a git commit hash to be used as image tag
# - name: Generate short hash
# id: commit-hash
# run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT

# qemu is used to emulate different platform architectures
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# # qemu is used to emulate different platform architectures
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3

# cross-platform build of the image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# # cross-platform build of the image
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

# authenticate for publish to docker hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ inputs.dockerhub-username }}
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
# # authenticate for publish to docker hub
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ inputs.dockerhub-username }}
# password: ${{ secrets.CI_DOCKERHUB_TOKEN }}

# publish to docker hub, tag with short git hash
- name: Build and push (goleveldb)
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
push: true
tags: kava/kava:${{ steps.commit-hash.outputs.short }}-goleveldb,kava/kava:master-goleveldb
# # publish to docker hub, tag with short git hash
# - name: Build and push (goleveldb)
# uses: docker/build-push-action@v5
# with:
# context: .
# cache-from: type=gha
# cache-to: type=gha,mode=max
# platforms: linux/amd64,linux/arm64
# push: true
# tags: kava/kava:${{ steps.commit-hash.outputs.short }}-goleveldb,kava/kava:master-goleveldb

docker-rocksdb:
# https://github.com/marketplace/actions/build-and-push-docker-images
runs-on: ubuntu-latest
steps:
# ensure working with latest code
- name: Checkout
uses: actions/checkout@v4
# docker-rocksdb:
# # https://github.com/marketplace/actions/build-and-push-docker-images
# runs-on: ubuntu-latest
# steps:
# # ensure working with latest code
# - name: Checkout
# uses: actions/checkout@v4

# generate a git commit hash to be used as image tag
- name: Generate short hash
id: commit-hash
run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
# # generate a git commit hash to be used as image tag
# - name: Generate short hash
# id: commit-hash
# run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT

# qemu is used to emulate different platform architectures
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# # qemu is used to emulate different platform architectures
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3

# cross-platform build of the image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# # cross-platform build of the image
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

# authenticate for publish to docker hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ inputs.dockerhub-username }}
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
# # authenticate for publish to docker hub
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ inputs.dockerhub-username }}
# password: ${{ secrets.CI_DOCKERHUB_TOKEN }}

# publish to docker hub, tag with short git hash
- name: Build and push (rocksdb)
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-rocksdb
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
push: true
tags: kava/kava:${{ steps.commit-hash.outputs.short }}-rocksdb,kava/kava:master-rocksdb
# # publish to docker hub, tag with short git hash
# - name: Build and push (rocksdb)
# uses: docker/build-push-action@v5
# with:
# context: .
# file: Dockerfile-rocksdb
# cache-from: type=gha
# cache-to: type=gha,mode=max
# platforms: linux/amd64,linux/arm64
# push: true
# tags: kava/kava:${{ steps.commit-hash.outputs.short }}-rocksdb,kava/kava:master-rocksdb
1 change: 1 addition & 0 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
uses: ./.github/workflows/ci-docker.yml
with:
dockerhub-username: kavaops
extra-image-tag: master
secrets: inherit
post-pipeline-metrics:
uses: ./.github/workflows/metric-pipeline.yml
Expand Down
86 changes: 21 additions & 65 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,26 @@ on:
branches:
- rp-ci-updates
jobs:
docker:
# https://github.com/marketplace/actions/build-and-push-docker-images
test-docker-master:
uses: ./.github/workflows/ci-docker.yml
with:
dockerhub-username: kavaops
extra-image-tag: master
secrets: inherit

get-git-tag:
runs-on: ubuntu-latest
outputs:
git-tag: ${{ steps.git-tag.outputs.tag }}
steps:
# ensure working with latest code
- name: Checkout
uses: actions/checkout@v4

# generate a git commit hash to be used as image tag
- name: Generate short hash
id: commit-hash
run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT

# qemu is used to emulate different platform architectures
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# cross-platform build of the image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# authenticate for publish to docker hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: kavaops # TODO set from inputs
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}

# publish to docker hub, tag with short git hash
- name: Build and push (rocksdb)
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-rocksdb
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
push: false #TODO set to true
tags: kava/kava:${{ steps.commit-hash.outputs.short }}-rocksdb # TODO add master tag back in


# test:
# runs-on: ubuntu-latest
# steps:
# - name: checkout repo from current commit
# uses: actions/checkout@v4
# with:
# submodules: true

# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version-file: go.mod
# cache-dependency-path: |
# go.sum
# tests/e2e/kvtool/go.sum

# - name: Configure docker to use go build cache
# uses: reproducible-containers/buildkit-cache-dance@v2.1.2
# with:
# cache-source: go-build-cache

# - name: run unit tests
# run: make test

# - name: run e2e tests
# run: make docker-build test-e2e
- id: git-tag
# TODO: change me to git command to find version tag
run: echo "tag=v0.25.0" >> $GITHUB_OUTPUT

test-docker-release:
needs: get-git-tag
uses: ./.github/workflows/ci-docker.yml
with:
dockerhub-username: kavaops
extra-image-tag: ${{ needs.get-git-tag.outputs.git-tag }}
secrets: inherit

0 comments on commit 9d3e01b

Please sign in to comment.