Skip to content

Commit

Permalink
misc: other fixes
Browse files Browse the repository at this point in the history
* Fix issue where the Drone CI couldn't push Windows container images to
  other registries.

* Update go.mod to use github.com/grafana/alloy/syntax v0.1.0.
  • Loading branch information
rfratto committed Apr 5, 2024
1 parent b06eb00 commit f2db8d9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
10 changes: 8 additions & 2 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,18 @@ platform:
version: "1809"
steps:
- commands:
- '& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows alloy'
- '& "C:/Program Files/git/bin/bash.exe" -c "mkdir -p $HOME/.docker"'
- '& "C:/Program Files/git/bin/bash.exe" -c "printenv GCR_CREDS > $HOME/.docker/config.json"'
- '& "C:/Program Files/git/bin/bash.exe" -c "docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD"'
- '& "C:/Program Files/git/bin/bash.exe" -c "./tools/ci/docker-containers-windows
alloy"'
environment:
DOCKER_LOGIN:
from_secret: docker_login
DOCKER_PASSWORD:
from_secret: docker_password
GCR_CREDS:
from_secret: gcr_admin
image: grafana/agent-build-image:0.40.2-windows
name: Build containers
volumes:
Expand Down Expand Up @@ -553,6 +559,6 @@ kind: secret
name: updater_private_key
---
kind: signature
hmac: 8dfa15c0fd4f3dde68d7099e77e6a4f90f3fd6685288805e6927f6ad24b9359a
hmac: 21df6cb02f24c4eab41dc3425f43c865141d400b2ad00571bde9a1803577e77c

...
10 changes: 9 additions & 1 deletion .drone/pipelines/publish.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ local linux_containers_jobs = std.map(function(container) (
}
), linux_containers);


local windows_bash_command = function(command)
'& "C:/Program Files/git/bin/bash.exe" -c "%s"' % command;

local windows_containers_jobs = std.map(function(container) (
pipelines.windows('Publish Windows %s container' % container) {
trigger: {
Expand All @@ -151,9 +155,13 @@ local windows_containers_jobs = std.map(function(container) (
environment: {
DOCKER_LOGIN: secrets.docker_login.fromSecret,
DOCKER_PASSWORD: secrets.docker_password.fromSecret,
GCR_CREDS: secrets.gcr_admin.fromSecret,
},
commands: [
'& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows %s' % container,
windows_bash_command('mkdir -p $HOME/.docker'),
windows_bash_command('printenv GCR_CREDS > $HOME/.docker/config.json'),
windows_bash_command('docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD'),
windows_bash_command('./tools/ci/docker-containers-windows %s' % container),
],
}],
volumes: [{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/grafana/agent-remote-config v0.0.2
github.com/grafana/alloy/syntax v0.0.0-00010101000000-000000000000
github.com/grafana/alloy/syntax v0.1.0
github.com/grafana/beyla v1.4.1-0.20240328093156-fca861576b2c
github.com/grafana/ckit v0.0.0-20230906125525-c046c99a5c04
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2
Expand Down
33 changes: 14 additions & 19 deletions tools/ci/docker-containers-windows
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,19 @@ case "$TARGET_CONTAINER" in
;;
esac

# Push images only if we have docker credentials and a drone tag is set
if [ -n "$DOCKER_LOGIN" ] && [ -n "$DOCKER_PASSWORD" ]; then
docker login -u "$DOCKER_LOGIN" -p "$DOCKER_PASSWORD"

case "$TARGET_CONTAINER" in
alloy)
docker push "$RELEASE_ALLOY_IMAGE:$VERSION_TAG"
docker push "$RELEASE_ALLOY_IMAGE:$BRANCH_TAG"
;;
case "$TARGET_CONTAINER" in
alloy)
docker push "$RELEASE_ALLOY_IMAGE:$VERSION_TAG"
docker push "$RELEASE_ALLOY_IMAGE:$BRANCH_TAG"
;;

alloy-devel)
docker push "$DEVEL_ALLOY_IMAGE:$VERSION_TAG"
docker push "$DEVEL_ALLOY_IMAGE:$BRANCH_TAG"
;;
alloy-devel)
docker push "$DEVEL_ALLOY_IMAGE:$VERSION_TAG"
docker push "$DEVEL_ALLOY_IMAGE:$BRANCH_TAG"
;;

*)
echo "Usage: $0 alloy|alloy-devel"
exit 1
;;
esac
fi
*)
echo "Usage: $0 alloy|alloy-devel"
exit 1
;;
esac

0 comments on commit f2db8d9

Please sign in to comment.