Compare commits
47
Commits
redis
...
shopee-wms
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
331896085d | ||
|
|
7ffcbdcdd6 | ||
|
|
3497567869 | ||
|
|
35406245ad | ||
|
|
6511f24900 | ||
|
|
fd0c20fc5a | ||
|
|
de7147ecce | ||
|
|
8971f25023 | ||
|
|
e12ef00e50 | ||
|
|
d47b62eb59 | ||
|
|
9dc7e0fe49 | ||
|
|
cbe714d0b6 | ||
|
|
6b3dfc0f50 | ||
|
|
a27dcf3256 | ||
|
|
33c8e2b350 | ||
|
|
ac10d5cf3e | ||
|
|
37e44ae70f | ||
|
|
21b2717a45 | ||
|
|
dcd0a05e1a | ||
|
|
eebfb30534 | ||
|
|
6f6336ba20 | ||
|
|
ec690ecb84 | ||
|
|
9c23e6c256 | ||
|
|
c293dc13db | ||
|
|
50f2266172 | ||
|
|
619a5c7c5e | ||
|
|
b0bcf7d43a | ||
|
|
a07413d8b6 | ||
|
|
a5a8498839 | ||
|
|
4f395c9997 | ||
|
|
f1ffdcddac | ||
|
|
331f7f03bb | ||
|
|
d279c78d6c | ||
|
|
10365464fa | ||
|
|
2fe6f40fd9 | ||
|
|
f9178f1dac | ||
|
|
aa6d790dbb | ||
|
|
06dbdbed7e | ||
|
|
686391a403 | ||
|
|
39d4bfa730 | ||
|
|
1114f2561c | ||
|
|
929bcfdf2e | ||
|
|
d624523547 | ||
|
|
e7829cd990 | ||
|
|
03e97547da | ||
|
|
0e4d45628a | ||
|
|
573b28a1b8 |
+163
-18
@@ -1,22 +1,167 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
# docker 打包
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
context: ./
|
||||
dockerfile: ./Dockerfile
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
registry: https://registry.cn-hangzhou.aliyuncs.com
|
||||
repo: registry.cn-hangzhou.aliyuncs.com/loghub/redis
|
||||
tags:
|
||||
- 8-alpine
|
||||
clone:
|
||||
retries: 3
|
||||
|
||||
volumes:
|
||||
- name: ruoyi_cache
|
||||
temp: {}
|
||||
concurrency:
|
||||
limit: 1
|
||||
|
||||
steps:
|
||||
# 拉取并打包 Shopee WES
|
||||
- name: deploy
|
||||
image: gradle:9-alpine
|
||||
pull: if-not-exists
|
||||
environment:
|
||||
DOCKER_CONFIG: /home/gradle/.docker
|
||||
JIB_USERNAME:
|
||||
from_secret: docker_username
|
||||
JIB_PASSWORD:
|
||||
from_secret: docker_password
|
||||
NEXUS_USERNAME:
|
||||
from_secret: nexus_username
|
||||
NEXUS_PASSWORD:
|
||||
from_secret: nexus_password
|
||||
NPM_USERNAME:
|
||||
from_secret: nexus_username
|
||||
NPM_PASSWORD:
|
||||
from_secret: nexus_password
|
||||
commands:
|
||||
- |
|
||||
if grep -qs ' /cache ' /proc/self/mountinfo && [ -w /cache ]; then
|
||||
export GRADLE_USER_HOME=/cache/wes-loghub/gradle-9.6.1
|
||||
export WES_WORKSPACE=/cache/wes-loghub/workspace
|
||||
mkdir -p "$GRADLE_USER_HOME" "$(dirname "$WES_WORKSPACE")"
|
||||
echo "===== persistent Gradle cache enabled: $GRADLE_USER_HOME ====="
|
||||
echo "===== persistent WES workspace enabled: $WES_WORKSPACE ====="
|
||||
else
|
||||
export GRADLE_USER_HOME=/opt/gradle-user-home
|
||||
export WES_WORKSPACE=/drone/src/wes-loghub
|
||||
echo "===== WARNING: /cache is not mounted; using ephemeral Gradle cache ====="
|
||||
fi
|
||||
- git --version
|
||||
- |
|
||||
test -n "${NEXUS_USERNAME:-${NPM_USERNAME:-}}" || {
|
||||
echo "Nexus username secret is missing"
|
||||
exit 1
|
||||
}
|
||||
test -n "${NEXUS_PASSWORD:-${NPM_PASSWORD:-}}" || {
|
||||
echo "Nexus password secret is missing"
|
||||
exit 1
|
||||
}
|
||||
- |
|
||||
if [ -d "$WES_WORKSPACE/.git" ]; then
|
||||
echo "===== updating persistent WES workspace ====="
|
||||
time git -C "$WES_WORKSPACE" fetch \
|
||||
--depth 1 \
|
||||
--no-tags \
|
||||
https://zwzeng:glpat-nuzkafsdgYKM0KAgvpL4Bm86MQp1OnkH.01.0w0tr4xa1@git.ittx.com.cn/wms/wes-loghub.git \
|
||||
proj-shopee-test
|
||||
git -C "$WES_WORKSPACE" checkout -B proj-shopee-test FETCH_HEAD
|
||||
else
|
||||
echo "===== creating persistent WES workspace ====="
|
||||
time git clone \
|
||||
-b proj-shopee-test \
|
||||
--depth 1 \
|
||||
--no-tags \
|
||||
https://zwzeng:glpat-nuzkafsdgYKM0KAgvpL4Bm86MQp1OnkH.01.0w0tr4xa1@git.ittx.com.cn/wms/wes-loghub.git \
|
||||
"$WES_WORKSPACE"
|
||||
fi
|
||||
git -C "$WES_WORKSPACE" remote set-url origin https://git.ittx.com.cn/wms/wes-loghub.git
|
||||
- git -C "$WES_WORKSPACE" log -1 --format='===== WES commit %H %s ====='
|
||||
- cd "$WES_WORKSPACE"
|
||||
- |
|
||||
(
|
||||
gradle_pids() {
|
||||
for proc_path in /proc/[0-9]*; do
|
||||
[ -r "$proc_path/cmdline" ] || continue
|
||||
proc_cmd=$(tr '\0' ' ' < "$proc_path/cmdline" 2>/dev/null)
|
||||
case "$proc_cmd" in
|
||||
*GradleDaemon*|*GradleWorkerMain*) basename "$proc_path" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
heartbeat_count=0
|
||||
while true; do
|
||||
heartbeat_count=$((heartbeat_count + 1))
|
||||
echo "===== build heartbeat $(date -Iseconds) ====="
|
||||
echo "load: $(cat /proc/loadavg)"
|
||||
awk '/MemTotal|MemAvailable/ { printf "%s %s kB ", $1, $2 } END { print "" }' /proc/meminfo
|
||||
echo "===== active Gradle tasks ====="
|
||||
cat /tmp/gradle-active-tasks 2>/dev/null || echo "none"
|
||||
echo "===== top processes ====="
|
||||
if command -v top >/dev/null 2>&1; then
|
||||
top -b -n 1 2>/dev/null | head -n 20
|
||||
else
|
||||
ps -ef
|
||||
fi
|
||||
echo "===== Gradle JVM I/O ====="
|
||||
for pid in $(gradle_pids); do
|
||||
echo "--- pid=$pid cmd=$(tr '\0' ' ' < /proc/$pid/cmdline 2>/dev/null)"
|
||||
awk '/read_bytes|write_bytes|cancelled_write_bytes/ { printf "%s ", $0 } END { print "" }' "/proc/$pid/io" 2>/dev/null || true
|
||||
done
|
||||
if [ $((heartbeat_count % 15)) -eq 0 ]; then
|
||||
echo "===== Gradle JVM thread dump after $((heartbeat_count * 60)) seconds ====="
|
||||
for pid in $(gradle_pids); do
|
||||
jcmd "$pid" Thread.print -l || true
|
||||
done
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
) &
|
||||
echo $! > /tmp/build-heartbeat.pid
|
||||
trap 'kill "$(cat /tmp/build-heartbeat.pid)" 2>/dev/null || true' EXIT
|
||||
- >
|
||||
time gradle jib -stacktrace
|
||||
--init-script=/drone/src/gradle-repositories.init.gradle
|
||||
--init-script=/drone/src/gradle-diagnostics.init.gradle
|
||||
--no-daemon
|
||||
--info
|
||||
--console=plain
|
||||
--warning-mode=summary
|
||||
--build-cache
|
||||
--configure-on-demand
|
||||
--parallel
|
||||
--max-workers=8
|
||||
-x test
|
||||
-PdockerBuild=true
|
||||
-Dcybertrans.idp.enabled=false
|
||||
-Djib.disableUpdateChecks=true
|
||||
-Djib.baseImageCache=$GRADLE_USER_HOME/caches/jib/base
|
||||
-Djib.applicationCache=$GRADLE_USER_HOME/caches/jib/application
|
||||
-Djib.from.image=registry.cn-hangzhou.aliyuncs.com/ttx/amazoncorretto:25-alpine3.23-jdk
|
||||
-Djib.from.auth.username=$JIB_USERNAME
|
||||
-Djib.from.auth.password=$JIB_PASSWORD
|
||||
-Djib.to.auth.username=$JIB_USERNAME
|
||||
-Djib.to.auth.password=$JIB_PASSWORD
|
||||
-Djib.to.image=registry.cn-hangzhou.aliyuncs.com/loghub/wes:shopee-wes-test-3
|
||||
-Djib.to.tags=shopee-wes-test-3
|
||||
-Djib.container.entrypoint='INHERIT'
|
||||
-Djib.container.args='java,-Dfile.encoding=utf-8,-Dspring.profiles.active=k8s,-Dserver.port=9210,-cp,/app/resources:/app/classes:/app/libs/*,com.ittx.Application'
|
||||
- >
|
||||
kill "$(cat /tmp/build-heartbeat.pid)" 2>/dev/null || true
|
||||
|
||||
---
|
||||
kind: secret
|
||||
name: docker_username
|
||||
get:
|
||||
path: drone/data/docker_username
|
||||
name: docker_username
|
||||
---
|
||||
kind: secret
|
||||
name: docker_password
|
||||
get:
|
||||
path: drone/data/docker_password
|
||||
name: docker_password
|
||||
---
|
||||
kind: secret
|
||||
name: nexus_username
|
||||
get:
|
||||
path: drone/data/nexus
|
||||
name: nexus_username
|
||||
---
|
||||
kind: secret
|
||||
name: nexus_password
|
||||
get:
|
||||
path: drone/data/nexus
|
||||
name: nexus_password
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.idea/
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM redis:8.6-rc1-alpine3.23
|
||||
|
||||
RUN set -eux; \
|
||||
apk update; \
|
||||
apk upgrade ;
|
||||
@@ -0,0 +1,34 @@
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import org.gradle.api.tasks.compile.GroovyCompile
|
||||
|
||||
def taskStartNanos = new ConcurrentHashMap<String, Long>()
|
||||
def activeTasksFile = new File('/tmp/gradle-active-tasks')
|
||||
|
||||
def writeActiveTasks = {
|
||||
synchronized (taskStartNanos) {
|
||||
def activeTasks = taskStartNanos.keySet().sort()
|
||||
activeTasksFile.text = activeTasks
|
||||
? activeTasks.join(System.lineSeparator()) + System.lineSeparator()
|
||||
: "none${System.lineSeparator()}"
|
||||
}
|
||||
}
|
||||
|
||||
gradle.beforeProject { project ->
|
||||
project.tasks.withType(GroovyCompile).configureEach {
|
||||
options.forkOptions.memoryMaximumSize = '1g'
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.beforeTask { task ->
|
||||
taskStartNanos.put(task.path, System.nanoTime())
|
||||
writeActiveTasks()
|
||||
println "[TASK START] ${task.path}"
|
||||
}
|
||||
|
||||
gradle.taskGraph.afterTask { task, state ->
|
||||
def startedAt = taskStartNanos.remove(task.path)
|
||||
def elapsedMs = startedAt == null ? 0 : (System.nanoTime() - startedAt) / 1_000_000
|
||||
def outcome = state.failure ? 'FAILED' : state.skipped ? 'SKIPPED' : 'DONE'
|
||||
println "[TASK END] ${task.path} ${outcome} ${elapsedMs} ms"
|
||||
writeActiveTasks()
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
def nexusUsername = System.getenv('NEXUS_USERNAME') ?: System.getenv('NPM_USERNAME')
|
||||
def nexusPassword = System.getenv('NEXUS_PASSWORD') ?: System.getenv('NPM_PASSWORD')
|
||||
|
||||
if (!nexusUsername || !nexusPassword) {
|
||||
throw new GradleException('Nexus credentials are not configured')
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = 'https://nexus.freeicu.top/repository/maven-public/' }
|
||||
maven {
|
||||
url = 'https://nexus.loghub.com/repository/public/'
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
maven { url = 'https://repo.huaweicloud.com/repository/maven/huaweicloudsdk' }
|
||||
maven { url = 'https://build.shibboleth.net/nexus/content/repositories/releases/' }
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = 'https://nexus.freeicu.top/repository/maven-public/' }
|
||||
maven {
|
||||
url = 'https://nexus.loghub.com/repository/public/'
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
maven { url = 'https://repo.huaweicloud.com/repository/maven/huaweicloudsdk' }
|
||||
maven { url = 'https://build.shibboleth.net/nexus/content/repositories/releases/' }
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = 'https://nexus.freeicu.top/repository/maven-public/' }
|
||||
maven {
|
||||
url = 'https://nexus.loghub.com/repository/public/'
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
maven { url = 'https://repo.huaweicloud.com/repository/maven/huaweicloudsdk' }
|
||||
maven { url = 'https://build.shibboleth.net/nexus/content/repositories/releases/' }
|
||||
}
|
||||
}
|
||||
|
||||
settingsEvaluated { settings ->
|
||||
settings.pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url = 'https://nexus.freeicu.top/repository/maven-public/' }
|
||||
maven {
|
||||
url = 'https://nexus.loghub.com/repository/public/'
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
maven { url = 'https://repo.huaweicloud.com/repository/maven/huaweicloudsdk' }
|
||||
maven { url = 'https://build.shibboleth.net/nexus/content/repositories/releases/' }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user