Simplify Drone CI by removing Gradle cache and redundant settings
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
26
.drone.yml
26
.drone.yml
@ -2,22 +2,15 @@ kind: pipeline
|
|||||||
type: docker
|
type: docker
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
# Enable BuildKit globally (docker plugin will pick this up)
|
|
||||||
environment:
|
environment:
|
||||||
DOCKER_BUILDKIT: 1
|
DOCKER_BUILDKIT: 1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test-and-jar
|
- name: test-and-jar
|
||||||
image: gradle:8.10.2-jdk21
|
image: gradle:8.10.2-jdk21
|
||||||
environment:
|
# No host volumes; keep cache in the container layer only
|
||||||
# Put the Gradle cache on a mounted volume
|
|
||||||
GRADLE_USER_HOME: /drone/.gradle
|
|
||||||
volumes:
|
|
||||||
- name: gradle-cache
|
|
||||||
path: /drone/.gradle
|
|
||||||
commands:
|
commands:
|
||||||
- gradle --version
|
- gradle --version
|
||||||
# Single invocation -> one dependency resolution, better cache reuse
|
|
||||||
- gradle --no-daemon clean test bootJar
|
- gradle --no-daemon clean test bootJar
|
||||||
|
|
||||||
- name: build-image
|
- name: build-image
|
||||||
@ -30,22 +23,15 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
# Keep your tags as-is
|
|
||||||
tags:
|
tags:
|
||||||
- ${DRONE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:7}
|
- ${DRONE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:7}
|
||||||
- latest
|
- latest
|
||||||
# Enable BuildKit and add traceability labels (OCI standard)
|
|
||||||
buildkit: true
|
buildkit: true
|
||||||
labels:
|
labels:
|
||||||
org.opencontainers.image.source: ${DRONE_GIT_HTTP_URL}
|
org.opencontainers.image.source: ${DRONE_GIT_HTTP_URL}
|
||||||
org.opencontainers.image.revision: ${DRONE_COMMIT_SHA}
|
org.opencontainers.image.revision: ${DRONE_COMMIT_SHA}
|
||||||
org.opencontainers.image.created: ${DRONE_BUILD_FINISHED}
|
org.opencontainers.image.created: ${DRONE_BUILD_FINISHED}
|
||||||
org.opencontainers.image.version: ${DRONE_TAG:-${DRONE_COMMIT_SHA:0:7}}
|
org.opencontainers.image.version: ${DRONE_TAG:-${DRONE_COMMIT_SHA:0:7}}
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
include: [ main, develop ]
|
|
||||||
event:
|
|
||||||
include: [ push, pull_request, tag ]
|
|
||||||
|
|
||||||
- name: publish-tag
|
- name: publish-tag
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
@ -57,7 +43,6 @@ steps:
|
|||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
# Tag builds get a clean semver tag
|
|
||||||
tags:
|
tags:
|
||||||
- ${DRONE_TAG}
|
- ${DRONE_TAG}
|
||||||
buildkit: true
|
buildkit: true
|
||||||
@ -66,18 +51,9 @@ steps:
|
|||||||
org.opencontainers.image.revision: ${DRONE_COMMIT_SHA}
|
org.opencontainers.image.revision: ${DRONE_COMMIT_SHA}
|
||||||
org.opencontainers.image.created: ${DRONE_BUILD_FINISHED}
|
org.opencontainers.image.created: ${DRONE_BUILD_FINISHED}
|
||||||
org.opencontainers.image.version: ${DRONE_TAG}
|
org.opencontainers.image.version: ${DRONE_TAG}
|
||||||
when:
|
|
||||||
event:
|
|
||||||
include: [ tag ]
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
- tag
|
- tag
|
||||||
|
|
||||||
volumes:
|
|
||||||
# Host (or tmp) volume to persist Gradle cache between builds
|
|
||||||
- name: gradle-cache
|
|
||||||
host:
|
|
||||||
path: /tmp/drone/gradle-cache
|
|
||||||
|
|||||||
Reference in New Issue
Block a user