-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: build windows containers #1467
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
b17bd21
feat: add windows Dockerfile
2b1f4bc
chore: force building container image
64b30b7
chore: fix building image
d073877
fix: fix artifact name
580853c
feat: support bulding windows image in ci/build-push-multiplatform.sh
94068b1
fix: fix building windows image
eee5129
chore: add dev-builds
07b0f52
chore: fix due to bash syntax issues
e0368dc
feat: do not push attestation manifest
bdda2f6
chore: use docker manifest instead of docker buildx
3d0f405
chore: add suffix to image tag
a9a5bbe
feat: add building windows containers for releases
2493756
chore: changelog
787cafa
Update ci/build-push-multiplatform.sh
sumo-drosiek a8185a6
Update ci/build-push-multiplatform.sh
sumo-drosiek 8e2b4e8
chore: add comment due to review
8b82ae5
chore: build multiple windows images
27adea3
chore: do not release windows containers
d8ba249
chore: unify dev and pr builds
ca0481e
chore: fix syntax
c886a1b
Update .github/workflows/dev_builds.yml
sumo-drosiek c6122e9
Update ci/build-push-multiplatform.sh
sumo-drosiek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
feat: build windows containers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ARG BASE_IMAGE_TAG=ltsc2022 | ||
FROM mcr.microsoft.com/windows/servercore:${BASE_IMAGE_TAG} | ||
ARG BUILD_TAG=latest | ||
ENV TAG $BUILD_TAG | ||
|
||
ADD /otelcol-sumo.exe /otelcol-sumo.exe | ||
ENTRYPOINT ["/otelcol-sumo.exe"] | ||
CMD ["--config", "/etc/otel/config.yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,21 +2,19 @@ | |
|
||
set -eo pipefail | ||
|
||
while ! docker buildx ls; do | ||
echo "Cannot connect to docker daemon" | ||
sleep 1 | ||
done | ||
if echo "${PLATFORM}" | grep -v windows; then | ||
|
||
DOCKER_BUILDX_LS_OUT=$(docker buildx ls <<-END | ||
DOCKER_BUILDX_LS_OUT=$(docker buildx ls <<-END | ||
END | ||
) | ||
readonly DOCKER_BUILDX_LS_OUT | ||
) | ||
readonly DOCKER_BUILDX_LS_OUT | ||
|
||
# check for arm support only if we try to build it | ||
if echo "${PLATFORM}" | grep -q arm && ! grep -q arm <<< "${DOCKER_BUILDX_LS_OUT}"; then | ||
echo "Your Buildx seems to lack ARM architecture support" | ||
echo "${DOCKER_BUILDX_LS_OUT}" | ||
exit 1 | ||
# check for arm support only if we try to build it | ||
if echo "${PLATFORM}" | grep -q arm && ! grep -q arm <<< "${DOCKER_BUILDX_LS_OUT}"; then | ||
echo "Your Buildx seems to lack ARM architecture support" | ||
echo "${DOCKER_BUILDX_LS_OUT}" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [[ -z "${BUILD_TAG}" ]]; then | ||
|
@@ -33,6 +31,10 @@ if [[ -z "${REPO_URL}" ]]; then | |
exit 1 | ||
fi | ||
|
||
if [[ ! -z "${BASE_IMAGE_TAG}" ]]; then | ||
BASE_IMAGE_TAG="-${BASE_IMAGE_TAG}" | ||
fi | ||
|
||
if [[ -z "${PLATFORM}" ]]; then | ||
echo "No PLATFORM passed in" | ||
exit 1 | ||
|
@@ -52,19 +54,44 @@ fi | |
# linux/arm/v7, linux/arm/v6 | ||
function build_push() { | ||
local BUILD_ARCH | ||
local BASE_IMAGE_TAG_SUFFIX | ||
set -x | ||
|
||
case "${PLATFORM}" in | ||
"linux/amd64"|"linux_amd64") | ||
readonly BUILD_ARCH="amd64" | ||
readonly BUILD_PLATFORM="linux" | ||
PLATFORM="linux/amd64" | ||
;; | ||
|
||
"linux/arm64"|"linux_arm64") | ||
readonly BUILD_ARCH="arm64" | ||
readonly BUILD_PLATFORM="linux" | ||
PLATFORM="linux/arm64" | ||
;; | ||
|
||
"windows/amd64"|"windows_amd64") | ||
readonly BUILD_ARCH="amd64" | ||
readonly BASE_IMAGE_TAG_SUFFIX="windows" | ||
PLATFORM="windows/amd64" | ||
;; | ||
|
||
"windows/amd64/ltsc2022"|"windows_amd64_ltsc2022") | ||
readonly BUILD_ARCH="amd64" | ||
readonly BUILD_PLATFORM="windows" | ||
readonly BASE_IMAGE_TAG_SUFFIX="-ltsc2022" | ||
readonly BASE_IMAGE_TAG="ltsc2022" | ||
PLATFORM="windows/amd64" | ||
;; | ||
|
||
"windows/amd64/ltsc2019"|"windows_amd64_ltsc2019") | ||
readonly BUILD_ARCH="amd64" | ||
readonly BUILD_PLATFORM="windows" | ||
readonly BASE_IMAGE_TAG_SUFFIX="-ltsc2019" | ||
readonly BASE_IMAGE_TAG="ltsc2019" | ||
PLATFORM="windows/amd64" | ||
;; | ||
|
||
# Can't really enable it for now because: | ||
# !shopify/[email protected]/gssapi_kerberos.go:62:10: constant 4294967295 overflows int | ||
# ref: https://github.com/SumoLogic/sumologic-otel-collector/runs/2805247906 | ||
|
@@ -82,33 +109,66 @@ function build_push() { | |
esac | ||
|
||
local TAG | ||
readonly TAG="${REPO_URL}:${BUILD_TAG}${BUILD_TYPE_SUFFIX}-${BUILD_ARCH}" | ||
readonly TAG="${REPO_URL}:${BUILD_TAG}${BUILD_TYPE_SUFFIX}-${BUILD_PLATFORM}-${BUILD_ARCH}${BASE_IMAGE_TAG_SUFFIX}" | ||
local LATEST_TAG | ||
readonly LATEST_TAG="${REPO_URL}:latest${BUILD_TYPE_SUFFIX}-${BUILD_ARCH}" | ||
readonly LATEST_TAG="${REPO_URL}:latest${BUILD_TYPE_SUFFIX}-${BUILD_PLATFORM}-${BUILD_ARCH}${BASE_IMAGE_TAG_SUFFIX}" | ||
|
||
# --provenance=false for docker buildx ensures that we create manifest instead of manifest list | ||
if [[ "${PUSH}" == true ]]; then | ||
echo "Building tags: ${TAG}, ${LATEST_TAG}" | ||
docker buildx build \ | ||
--push \ | ||
--file "${DOCKERFILE}" \ | ||
--build-arg BUILD_TAG="${BUILD_TAG}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform="${PLATFORM}" \ | ||
--tag "${LATEST_TAG}" \ | ||
--tag "${TAG}" \ | ||
. | ||
|
||
if [[ "${BUILD_PLATFORM}" == "windows" ]]; then | ||
docker build \ | ||
--file "${DOCKERFILE}" \ | ||
--build-arg BUILD_TAG="${BUILD_TAG}" \ | ||
--build-arg BASE_IMAGE_TAG="${BASE_IMAGE_TAG}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform="${PLATFORM}" \ | ||
--tag "${LATEST_TAG}" \ | ||
. | ||
|
||
docker tag "${LATEST_TAG}" "${TAG}" | ||
|
||
docker push "${LATEST_TAG}" | ||
docker push "${TAG}" | ||
else | ||
docker buildx build \ | ||
--push \ | ||
--file "${DOCKERFILE}" \ | ||
--build-arg BUILD_TAG="${BUILD_TAG}" \ | ||
--build-arg BASE_IMAGE_TAG="${BASE_IMAGE_TAG}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform="${PLATFORM}" \ | ||
--tag "${LATEST_TAG}" \ | ||
--tag "${TAG}" \ | ||
--provenance=false \ | ||
sumo-drosiek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
. | ||
fi | ||
else | ||
echo "Building tag: latest${BUILD_TYPE_SUFFIX}" | ||
# load flag is needed so that docker loads this image | ||
# for subsequent steps on github actions | ||
docker buildx build \ | ||
--file "${DOCKERFILE}" \ | ||
--build-arg BUILD_TAG="latest${BUILD_TYPE_SUFFIX}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform="${PLATFORM}" \ | ||
--load \ | ||
--tag "${REPO_URL}:latest${BUILD_TYPE_SUFFIX}" \ | ||
. | ||
if [[ "${BUILD_PLATFORM}" == "windows" ]]; then | ||
docker build \ | ||
--file "${DOCKERFILE}" \ | ||
--build-arg BUILD_TAG="latest${BUILD_TYPE_SUFFIX}" \ | ||
--build-arg BASE_IMAGE_TAG="${BASE_IMAGE_TAG}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform="${PLATFORM}" \ | ||
--tag "${REPO_URL}:latest${BUILD_TYPE_SUFFIX}" \ | ||
. | ||
else | ||
# load flag is needed so that docker loads this image | ||
# for subsequent steps on github actions | ||
docker buildx build \ | ||
--file "${DOCKERFILE}" \ | ||
--build-arg BUILD_TAG="latest${BUILD_TYPE_SUFFIX}" \ | ||
--build-arg BASE_IMAGE_TAG="${BASE_IMAGE_TAG}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--platform="${PLATFORM}" \ | ||
--load \ | ||
--tag "${REPO_URL}:latest${BUILD_TYPE_SUFFIX}" \ | ||
sumo-drosiek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--provenance=false \ | ||
. | ||
fi | ||
fi | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we tried downloading the unattended installation of the buildx component from here?, looks like there are windows executables
https://github.com/docker/buildx?tab=readme-ov-file#manual-download
Binaries from the github release page
https://github.com/docker/buildx/releases/tag/v0.12.1
got the above from this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nvm, looks like this is the root cause - docker/buildx#176, buildx on windows containers not supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe it is suppored, but I would prefer to have more control over what happening with windows image builds and also avoid experimenting support. I would feel more comfortable to switch to it when it will be fully supported, or maybe if we go for FIPS/arm64