Skip to content

Commit

Permalink
Modify the Github process
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Jan 29, 2024
1 parent a603d68 commit 219761e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
run: |
echo ::set-output name=sha_short::$(git rev-parse --short=8 ${{ github.sha }})
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/}
mkdir -p build/
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
Expand All @@ -66,5 +67,6 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: k8ssandra/k8ssandra-client:${{ steps.vars.outputs.sha_short }}
platforms: linux/amd64,linux/arm64
context: .
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Cass Operator Release
name: k8ssandra-client Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
# Allow to rerun this for a tag to get updated UBI-images

jobs:
release_cass_operator:
Expand Down Expand Up @@ -42,13 +40,15 @@ jobs:
echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "TARGET_VERSION=$(echo ${GITHUB_REF#refs/tags/} | awk '{print substr($0,2)}')" >> $GITHUB_ENV
mkdir -p build/
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
load: false
file: cmd/kubectl-k8ssandra/Dockerfile
push: true
context: .
tags: k8ssandra/k8ssandra-client:${{ steps.vars.outputs.tag_name }}, ghcr.io/k8ssandra/k8ssandra-client:${{ steps.vars.outputs.tag_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/tools-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ on:
repoName:
description: 'Name of the Helm repository if not default'
required: false
type: boolean
type: string
repoURL:
description: 'URL of the target repository if repoName is set'
required: false
type: boolean
type: string
jobs:
create_the_image:
runs-on: ubuntu-latest
Expand All @@ -26,9 +26,16 @@ jobs:
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: azure/setup-helm@v3
if: ${{ env.ACT }}
with:
version: '3.13.1'
id: install
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: ${{ !env.ACT }}
uses: docker/setup-qemu-action@v2
- name: Login to DockerHub
if: ${{ !env.ACT }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
Expand All @@ -45,16 +52,16 @@ jobs:
helm pull ${{ inputs.repoName }}/${{ inputs.chartName }} --version ${{ inputs.targetVersion }}
mkdir -p build/${{ inputs.repoName }}
tar -xvf ${{ inputs.chartName }}-${{ inputs.targetVersion }}.tgz -C build/${{ inputs.repoName }}
# TODO Add docker tags to indicate which tag/SHA this release was based on for easier debugging
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
load: false
file: cmd/kubectl-k8ssandra/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' && !env.ACT }}
tags: k8ssandra/k8ssandra-client:${{ steps.vars.outputs.tag }}
platforms: linux/amd64,linux/arm64
context: .
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

6 changes: 3 additions & 3 deletions cmd/kubectl-k8ssandra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ COPY cmd/ cmd/
COPY pkg/ pkg/

# Copy the cached helm charts
RUN mkdir -p /workspace/.cache/
COPY build/ /workspace/.cache/
RUN mkdir -p build/
COPY build/ build/

# Build
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o kubectl-k8ssandra cmd/kubectl-k8ssandra/main.go
Expand All @@ -36,7 +36,7 @@ LABEL description="Part of the toolset for the DataStax Kubernetes Operator for

WORKDIR /
COPY --from=builder /workspace/kubectl-k8ssandra .
COPY --from=builder --chown=65532:65532 /workspace/.cache/ .cache/
COPY --from=builder --chown=65532:65532 /workspace/build/ .cache/
COPY ./LICENSE /licenses/

USER 65532:65532
Expand Down

0 comments on commit 219761e

Please sign in to comment.