GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Support multi-arch builds by Pearl1594 · Pull Request #3 · cloudstack/cloudstack-csi-driver Conversation
|
| File | Description |
|---|---|
| cmd/cloudstack-csi-driver/Dockerfile | Added multi-stage build with builder stage for Go compilation and multi-arch support |
| cmd/cloudstack-csi-sc-syncer/Dockerfile | Added multi-stage build with builder stage for Go compilation and multi-arch support |
| .github/workflows/release.yaml | Updated to use Docker Buildx for multi-platform builds; removed make container step; added Go build step for syncer binary upload |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| - name: Build syncer binary for upload | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
| run: | | ||
| REV=$(git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD) | ||
| GIT_COMMIT=$(git rev-parse HEAD) | ||
| BUILD_DATE=$(date -u -Iseconds) | ||
| PKG=github.com/cloudstack/cloudstack-csi-driver | ||
| LDFLAGS="-s -w -X ${PKG}/pkg/driver.driverVersion=${REV} -X ${PKG}/pkg/driver.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/driver.buildDate=${BUILD_DATE}" | ||
|
|
||
| mkdir -p bin | ||
| CGO_ENABLED=0 go build -ldflags "${LDFLAGS}" -o ./bin/cloudstack-csi-sc-syncer ./cmd/cloudstack-csi-sc-syncer |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The 'Build syncer binary for upload' step attempts to run go build but there's no Go setup step in this workflow. This will fail because Go is not installed on the runner. Add a setup-go action before this step, similar to the PR check workflow which uses actions/setup-go@v5 with go-version: \"1.23\".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ARG TARGETOS | ||
| ARG TARGETARCH |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The build arguments TARGETOS and TARGETARCH are declared but Docker Buildx automatically provides these as built-in arguments when using --platform. You should add default values for these arguments to ensure the Dockerfile works correctly in non-buildx contexts. For example: ARG TARGETOS=linux and ARG TARGETARCH=amd64.
| ARG TARGETOS | |
| ARG TARGETARCH | |
| ARG TARGETOS=linux | |
| ARG TARGETARCH=amd64 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ARG TARGETOS | ||
| ARG TARGETARCH |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The build arguments TARGETOS and TARGETARCH are declared but Docker Buildx automatically provides these as built-in arguments when using --platform. You should add default values for these arguments to ensure the Dockerfile works correctly in non-buildx contexts. For example: ARG TARGETOS=linux and ARG TARGETARCH=amd64.
| ARG TARGETOS | |
| ARG TARGETARCH | |
| ARG TARGETOS=linux | |
| ARG TARGETARCH=amd64 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| REV=$(git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD) | ||
| GIT_COMMIT=$(git rev-parse HEAD) | ||
| BUILD_DATE=$(date -u -Iseconds) | ||
| PKG=github.com/cloudstack/cloudstack-csi-driver | ||
| LDFLAGS="-s -w -X ${PKG}/pkg/driver.driverVersion=${REV} -X ${PKG}/pkg/driver.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/driver.buildDate=${BUILD_DATE}" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The LDFLAGS construction is duplicated across three separate steps (lines 47-51, 69-73, and 89-93). Consider extracting this logic into a reusable composite action or a separate script to reduce code duplication and ensure consistency.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| - name: Build syncer binary for upload | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
| run: | | ||
| REV=$(git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can we move all these params to a single step? this will make the github actions cleaner.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| LDFLAGS="-s -w -X ${PKG}/pkg/driver.driverVersion=${REV} -X ${PKG}/pkg/driver.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/driver.buildDate=${BUILD_DATE}" | ||
|
|
||
| mkdir -p bin | ||
| CGO_ENABLED=0 go build -ldflags "${LDFLAGS}" -o ./bin/cloudstack-csi-sc-syncer ./cmd/cloudstack-csi-sc-syncer |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Would this build binaries for all architectures?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
clgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.