From 219761e36111deeffb828653ac6f324e392fedc5 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Mon, 29 Jan 2024 23:51:09 +0200 Subject: [PATCH] Modify the Github process --- .github/workflows/build-client.yaml | 2 ++ .github/workflows/release.yaml | 6 +++--- .github/workflows/tools-release.yaml | 17 ++++++++++++----- cmd/kubectl-k8ssandra/Dockerfile | 6 +++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-client.yaml b/.github/workflows/build-client.yaml index c0fca6c..a27934e 100644 --- a/.github/workflows/build-client.yaml +++ b/.github/workflows/build-client.yaml @@ -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 @@ -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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3778f22..646ab8b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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: @@ -42,6 +40,7 @@ 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 @@ -49,6 +48,7 @@ jobs: 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 diff --git a/.github/workflows/tools-release.yaml b/.github/workflows/tools-release.yaml index 11bbd17..843b039 100644 --- a/.github/workflows/tools-release.yaml +++ b/.github/workflows/tools-release.yaml @@ -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 @@ -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 }} @@ -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 \ No newline at end of file diff --git a/cmd/kubectl-k8ssandra/Dockerfile b/cmd/kubectl-k8ssandra/Dockerfile index 3f8e079..94210ae 100644 --- a/cmd/kubectl-k8ssandra/Dockerfile +++ b/cmd/kubectl-k8ssandra/Dockerfile @@ -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 @@ -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