Skip to content

Commit

Permalink
ci: separate out docker plguin build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Dec 11, 2024
1 parent 2b3c8cc commit fdc505c
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/jsonnetfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"subdir": "workflows"
}
},
"version": "62e4b9937d80cb0300a1364b632563dab20f3fe8"
"version": "502f98811e3768072698cc5c589c889c60025428"
}
],
"legacyImports": true
Expand Down
4 changes: 2 additions & 2 deletions .github/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"subdir": "workflows"
}
},
"version": "62e4b9937d80cb0300a1364b632563dab20f3fe8",
"sum": "8XWtvG8Ti+y8sLtrgaZNdr6A7Zc573CGJqqxcUX+N8A="
"version": "502f98811e3768072698cc5c589c889c60025428",
"sum": "a/V79sNGV4kSBRc2b8UtAKnceSR6fmvSKYlrCPDoBKY="
}
],
"legacyImports": false
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 3 additions & 14 deletions .github/workflows/minor-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -652,27 +652,16 @@ jobs:
BUILD_IMAGE=grafana/loki-build-image:0.34.3
context: "release"
file: "release/clients/cmd/docker-driver/Dockerfile"
outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
outputs: "type=docker,dest=release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
platforms: "${{ matrix.platform }}"
push: false
tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}"
- env:
BUILD_DIR: "clients/cmd/docker-driver"
IMAGE_TAG: "${{ needs.version.outputs.version }}"
if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "Package as Docker plugin"
run: |
rm -rf "${{ env.BUILD_DIR }}/rootfs" || true
mkdir "${{ env.BUILD_DIR }}/rootfs"
tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}"
working-directory: "release"
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "upload artifacts"
uses: "google-github-actions/upload-cloud-storage@v2"
with:
destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images"
path: "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/plugins"
path: "release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
process_gcloudignore: false
strategy:
fail-fast: true
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/patch-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -652,27 +652,16 @@ jobs:
BUILD_IMAGE=grafana/loki-build-image:0.34.3
context: "release"
file: "release/clients/cmd/docker-driver/Dockerfile"
outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
outputs: "type=docker,dest=release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
platforms: "${{ matrix.platform }}"
push: false
tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}"
- env:
BUILD_DIR: "clients/cmd/docker-driver"
IMAGE_TAG: "${{ needs.version.outputs.version }}"
if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "Package as Docker plugin"
run: |
rm -rf "${{ env.BUILD_DIR }}/rootfs" || true
mkdir "${{ env.BUILD_DIR }}/rootfs"
tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}"
working-directory: "release"
- if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "upload artifacts"
uses: "google-github-actions/upload-cloud-storage@v2"
with:
destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images"
path: "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/plugins"
path: "release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
process_gcloudignore: false
strategy:
fail-fast: true
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,46 @@ jobs:
parent: false
path: "release/dist"
process_gcloudignore: false
publishDockerDriver:
needs:
- "createRelease"
runs-on: "ubuntu-latest"
steps:
- name: "pull release library code"
uses: "actions/checkout@v4"
with:
path: "lib"
ref: "${{ env.RELEASE_LIB_REF }}"
repository: "grafana/loki-release"
- name: "auth gcs"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
with:
version: ">= 452.0.0"
- name: "Set up QEMU"
uses: "docker/setup-qemu-action@v3"
- name: "set up docker buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Login to DockerHub (from vault)"
uses: "grafana/shared-workflows/actions/dockerhub-login@main"
- name: "download plugins"
run: |
echo "downloading images to $(pwd)/plugins"
gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/plugins .
- env:
BUILD_DIR: "clients/cmd/docker-driver"
IMAGE_TAG: "${{ needs.version.outputs.version }}"
if: "${{ fromJSON(needs.version.outputs.pr_created) }}"
name: "Package as Docker plugin"
run: |
rm -rf "${{ env.BUILD_DIR }}/rootfs" || true
mkdir "${{ env.BUILD_DIR }}/rootfs"
tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
docker plugin create "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" "${{ env.BUILD_DIR }}"
docker plugin push "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}"
publishImages:
needs:
- "createRelease"
Expand Down

0 comments on commit fdc505c

Please sign in to comment.