Compare commits

...

1 commit

Author SHA1 Message Date
82ee73b164
test: add ci-build-container to pipeline trigger for testing
Some checks failed
continuous-integration/drone/push Build is failing
2025-10-30 19:06:19 +01:00

View file

@ -1,13 +1,8 @@
kind: pipeline kind: pipeline
type: docker type: docker
name: check name: build-and-publish
services: services:
- name: postgres
image: docker.io/library/postgres:17.6
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: docker - name: docker
image: docker:dind image: docker:dind
privileged: true privileged: true
@ -16,26 +11,52 @@ services:
path: /var/run path: /var/run
trigger: trigger:
branch:
- main
- ci-build-container # TODO: Remove after testing
event: event:
- push - push
- tag
steps: steps:
- name: build & publish container? - name: build-and-publish-container
image: docker:dind image: docker:cli
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run path: /var/run
environment:
REGISTRY: git.local-it.org/ci-builder
IMAGE_NAME: mitgliederverwaltung
REGISTRY_USERNAME:
from_secret: DRONE_REGISTRY_USERNAME
REGISTRY_TOKEN:
from_secret: DRONE_REGISTRY_TOKEN
commands: commands:
- sleep 6 # give docker time to start - sleep 6 # give docker time to start
- docker build --tag git.local-it.org/ci-builder/mitgliederverwaltung:latest . # Build image once
- docker login --username $DRONE_FORGEJO_ACCOUNT_USERNAME --password $DRONE_FORGEJO_ACCOUNT_PASSWORD git.local-it.org - docker build --tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER .
- docker push git.local-it.org/ci-builder/mitgliederverwaltung:latest # Login to registry
- echo "$REGISTRY_TOKEN" | docker login --username "$REGISTRY_USERNAME" --password-stdin git.local-it.org
# Tag and push based on event type
- |
if [ "$DRONE_BUILD_EVENT" = "tag" ]; then
# For tag events: use tag version (e.g., v1.0.0 -> 1.0.0) and latest
VERSION=$(echo $DRONE_TAG | sed 's/^v//')
echo "Tagging and pushing version $VERSION"
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:$VERSION
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:latest
docker push $REGISTRY/$IMAGE_NAME:$VERSION
docker push $REGISTRY/$IMAGE_NAME:latest
else
# For main branch pushes: use commit SHA and latest
echo "Tagging and pushing commit $DRONE_COMMIT_SHA"
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:$DRONE_COMMIT_SHA
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:latest
docker push $REGISTRY/$IMAGE_NAME:$DRONE_COMMIT_SHA
docker push $REGISTRY/$IMAGE_NAME:latest
fi
volumes: volumes:
- name: cache
host:
path: /tmp/drone_cache
- name: dockersock - name: dockersock
temp: {} temp: {}