Skip to content

The Unified and Autonomous Development Platform

versioning server docker image

Robin Shenacb629295a67
diff --git a/docker/build.sh b/docker/build.sh
deleted file mode 100755
index af8d54bedb..0000000000
--- a/docker/build.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-mvn clean package -f ../pom.xml
-rm -rf build onedev-*
-unzip ../server-product/target/onedev-*.zip
-mv onedev-* build
-cp ../server-product/target/sandbox/site/lib/mysql* ../server-product/target/sandbox/site/lib/postgresql* build/site/lib
-docker build -t 1dev/server:latest .
-docker push 1dev/server:latest
-rm -rf build
diff --git a/docker/run.sh b/docker/run.sh
deleted file mode 100755
index 80de008b22..0000000000
--- a/docker/run.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /opt/onedev:/opt/onedev -p 6610:6610 1dev/server
diff --git a/k8s/mini/disk-settings.yaml b/k8s/mini/disk-settings.yaml
deleted file mode 100644
index ca6c26e339..0000000000
--- a/k8s/mini/disk-settings.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: onedev
-spec:
- resources:
- requests:
- storage: 1Gi
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: mysql
-spec:
- resources:
- requests:
- storage: 1Gi
diff --git a/k8s/production/disk-settings.yaml b/k8s/production/disk-settings.yaml
deleted file mode 100644
index b2d9b4cabc..0000000000
--- a/k8s/production/disk-settings.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: onedev
-spec:
- resources:
- requests:
- storage: 100Gi
----
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
- name: mysql
-spec:
- resources:
- requests:
- storage: 10Gi
diff --git a/pom.xml b/pom.xml
index 5941e12d13..872eafeaa5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
<version>1.0.3</version>
</parent>
<artifactId>server</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
<packaging>pom</packaging>
<build>
<finalName>${project.groupId}.${project.artifactId}-${project.version}</finalName>
diff --git a/server-core/pom.xml b/server-core/pom.xml
index d046166d9b..0bca126493 100644
--- a/server-core/pom.xml
+++ b/server-core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<build>
<plugins>
diff --git a/server-plugin/pom.xml b/server-plugin/pom.xml
index cc169a7ad1..1c4642a288 100644
--- a/server-plugin/pom.xml
+++ b/server-plugin/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-archetype/pom.xml b/server-plugin/server-plugin-archetype/pom.xml
index f2de6d1755..9ea00613db 100644
--- a/server-plugin/server-plugin-archetype/pom.xml
+++ b/server-plugin/server-plugin-archetype/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<build>
<resources>
diff --git a/server-plugin/server-plugin-cispec-gradle/pom.xml b/server-plugin/server-plugin-cispec-gradle/pom.xml
index 8bd1a4f989..66823d1226 100644
--- a/server-plugin/server-plugin-cispec-gradle/pom.xml
+++ b/server-plugin/server-plugin-cispec-gradle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/server-plugin/server-plugin-cispec-maven/pom.xml b/server-plugin/server-plugin-cispec-maven/pom.xml
index a155ed7138..11c1a21d9b 100644
--- a/server-plugin/server-plugin-cispec-maven/pom.xml
+++ b/server-plugin/server-plugin-cispec-maven/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.cispec.maven.MavenModule</moduleClass>
diff --git a/server-plugin/server-plugin-cispec-node/pom.xml b/server-plugin/server-plugin-cispec-node/pom.xml
index 2cb09030e8..7dff091ca3 100644
--- a/server-plugin/server-plugin-cispec-node/pom.xml
+++ b/server-plugin/server-plugin-cispec-node/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.cispec.node.NodePluginModule</moduleClass>
diff --git a/server-plugin/server-plugin-executor-docker/pom.xml b/server-plugin/server-plugin-executor-docker/pom.xml
index 4289fe6a78..f7b88790e6 100644
--- a/server-plugin/server-plugin-executor-docker/pom.xml
+++ b/server-plugin/server-plugin-executor-docker/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.docker.DockerModule</moduleClass>
diff --git a/server-plugin/server-plugin-executor-kubernetes/pom.xml b/server-plugin/server-plugin-executor-kubernetes/pom.xml
index 77291cd360..c9b3e71be9 100644
--- a/server-plugin/server-plugin-executor-kubernetes/pom.xml
+++ b/server-plugin/server-plugin-executor-kubernetes/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.executor.kubernetes.KubernetesModule</moduleClass>
diff --git a/server-plugin/server-plugin-report-html/pom.xml b/server-plugin/server-plugin-report-html/pom.xml
index 0cd023cc79..7d6f7dd480 100644
--- a/server-plugin/server-plugin-report-html/pom.xml
+++ b/server-plugin/server-plugin-report-html/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server-plugin</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<properties>
<moduleClass>io.onedev.server.plugin.report.html.HtmlReportModule</moduleClass>
diff --git a/server-product/build/build.sh b/server-product/build/build.sh
new file mode 100755
index 0000000000..9aea277568
--- /dev/null
+++ b/server-product/build/build.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+buildVersion=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout -f ../../pom.xml)
+mvn clean package -f ../../pom.xml
+
+mkdir ../target/docker
+cp docker/* ../target/docker
+unzip ../target/onedev-${buildVersion}.zip -d ../target/docker
+mv ../target/docker/onedev-${buildVersion} ../target/docker/onedev
+cp ../target/sandbox/site/lib/mysql* ../target/sandbox/site/lib/postgresql* ../target/docker/onedev/site/lib
+docker build -t 1dev/server:${buildVersion} ../target/docker
+docker push 1dev/server:${buildVersion}
+
+cp -r k8s ../target/k8s
+find ../target/k8s -name "*.yaml" | xargs sed -i -e "s/\${buildVersion}/${buildVersion}/g"
diff --git a/docker/Dockerfile b/server-product/build/docker/Dockerfile
similarity index 92%
rename from docker/Dockerfile
rename to server-product/build/docker/Dockerfile
index 27808e28f3..b6de1dc0f8 100644
--- a/docker/Dockerfile
+++ b/server-product/build/docker/Dockerfile
@@ -1,5 +1,5 @@
FROM ubuntu:18.04
-COPY build /app
+COPY onedev /app
COPY entrypoint.sh idle.sh /root/bin/
COPY kubectl /usr/local/bin/
RUN apt-get update && apt-get install -y curl git openjdk-8-jre-headless
diff --git a/docker/entrypoint.sh b/server-product/build/docker/entrypoint.sh
similarity index 100%
rename from docker/entrypoint.sh
rename to server-product/build/docker/entrypoint.sh
diff --git a/docker/idle.sh b/server-product/build/docker/idle.sh
similarity index 100%
rename from docker/idle.sh
rename to server-product/build/docker/idle.sh
diff --git a/docker/kubectl b/server-product/build/docker/kubectl
similarity index 100%
rename from docker/kubectl
rename to server-product/build/docker/kubectl
diff --git a/server-product/build/docker/run.sh b/server-product/build/docker/run.sh
new file mode 100755
index 0000000000..b5083449eb
--- /dev/null
+++ b/server-product/build/docker/run.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+buildVersion=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout -f ../pom.xml)
+docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /opt/onedev:/opt/onedev -p 6610:6610 1dev/server:${buildVersion}
diff --git a/k8s/base/cluster-role-bindings.yaml b/server-product/build/k8s/base/cluster-role-bindings.yaml
similarity index 100%
rename from k8s/base/cluster-role-bindings.yaml
rename to server-product/build/k8s/base/cluster-role-bindings.yaml
diff --git a/k8s/base/cluster-roles.yaml b/server-product/build/k8s/base/cluster-roles.yaml
similarity index 100%
rename from k8s/base/cluster-roles.yaml
rename to server-product/build/k8s/base/cluster-roles.yaml
diff --git a/server-product/build/k8s/base/deployments.yaml b/server-product/build/k8s/base/deployments.yaml
new file mode 100644
index 0000000000..549a37bf36
--- /dev/null
+++ b/server-product/build/k8s/base/deployments.yaml
@@ -0,0 +1,96 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: onedev
+ labels:
+ tier: server
+spec:
+ selector:
+ matchLabels:
+ tier: server
+ strategy:
+ type: Recreate
+ template:
+ metadata:
+ name: onedev
+ labels:
+ tier: server
+ spec:
+ containers:
+ - name: onedev
+ image: 1dev/server
+ volumeMounts:
+ - mountPath: "/opt/onedev"
+ name: onedev
+ ports:
+ - containerPort: 6610
+ env:
+ - name: hibernate_dialect
+ value: org.hibernate.dialect.MySQL5InnoDBDialect
+ - name: hibernate_connection_driver_class
+ value: com.mysql.cj.jdbc.Driver
+ - name: hibernate_connection_url
+ value: jdbc:mysql://mysql:3306/onedev?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false
+ - name: hibernate_connection_username
+ value: onedev
+ - name: hibernate_connection_password
+ valueFrom:
+ secretKeyRef:
+ name: mysql
+ key: password
+ initContainers:
+ - name: init
+ image: busybox
+ command: ["sh", "-c", "until nslookup mysql.onedev.svc.cluster.local; do echo waiting for mysql; sleep 2; done;"]
+ serviceAccountName: onedev
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: mysql
+ labels:
+ tier: database
+spec:
+ selector:
+ matchLabels:
+ tier: database
+ strategy:
+ type: Recreate
+ template:
+ metadata:
+ name: mysql
+ labels:
+ tier: database
+ spec:
+ containers:
+ - name: mysql
+ image: mysql:5.7
+ args:
+ - "--ignore-db-dir=lost+found"
+ env:
+ - name: MYSQL_RANDOM_ROOT_PASSWORD
+ value: "yes"
+ - name: MYSQL_DATABASE
+ value: onedev
+ - name: MYSQL_USER
+ value: onedev
+ - name: MYSQL_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: mysql
+ key: password
+ ports:
+ - containerPort: 3306
+ volumeMounts:
+ - name: mysql
+ mountPath: /var/lib/mysql
+ readinessProbe:
+ exec:
+ command:
+ - bash
+ - "-c"
+ - |
+ mysql -uonedev -p$MYSQL_PASSWORD -e 'SELECT 1'
+ initialDelaySeconds: 5
+ periodSeconds: 2
+ timeoutSeconds: 1
diff --git a/k8s/base/kustomization.yaml b/server-product/build/k8s/base/kustomization.yaml
similarity index 100%
rename from k8s/base/kustomization.yaml
rename to server-product/build/k8s/base/kustomization.yaml
diff --git a/k8s/base/namespaces.yaml b/server-product/build/k8s/base/namespaces.yaml
similarity index 100%
rename from k8s/base/namespaces.yaml
rename to server-product/build/k8s/base/namespaces.yaml
diff --git a/k8s/base/persistent-volume-claims.yaml b/server-product/build/k8s/base/persistent-volume-claims.yaml
similarity index 100%
rename from k8s/base/persistent-volume-claims.yaml
rename to server-product/build/k8s/base/persistent-volume-claims.yaml
diff --git a/k8s/base/service-accounts.yaml b/server-product/build/k8s/base/service-accounts.yaml
similarity index 100%
rename from k8s/base/service-accounts.yaml
rename to server-product/build/k8s/base/service-accounts.yaml
diff --git a/k8s/base/services.yaml b/server-product/build/k8s/base/services.yaml
similarity index 100%
rename from k8s/base/services.yaml
rename to server-product/build/k8s/base/services.yaml
diff --git a/k8s/maintenance/deployments.yaml b/server-product/build/k8s/maintenance/deployments.yaml
similarity index 100%
rename from k8s/maintenance/deployments.yaml
rename to server-product/build/k8s/maintenance/deployments.yaml
diff --git a/k8s/maintenance/kustomization.yaml b/server-product/build/k8s/maintenance/kustomization.yaml
similarity index 100%
rename from k8s/maintenance/kustomization.yaml
rename to server-product/build/k8s/maintenance/kustomization.yaml
diff --git a/k8s/mini/README.md b/server-product/build/k8s/mini/README.md
similarity index 100%
rename from k8s/mini/README.md
rename to server-product/build/k8s/mini/README.md
diff --git a/server-product/build/k8s/mini/disk-settings.yaml b/server-product/build/k8s/mini/disk-settings.yaml
new file mode 100644
index 0000000000..b396214af4
--- /dev/null
+++ b/server-product/build/k8s/mini/disk-settings.yaml
@@ -0,0 +1,45 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: onedev
+spec:
+ template:
+ spec:
+ containers:
+ - name: onedev
+ volumes:
+ - name: onedev
+ persistentVolumeClaim:
+ claimName: onedev
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: mysql
+spec:
+ template:
+ spec:
+ containers:
+ - name: mysql
+ volumes:
+ - name: mysql
+ persistentVolumeClaim:
+ claimName: mysql
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: onedev
+spec:
+ resources:
+ requests:
+ storage: 1Gi
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: mysql
+spec:
+ resources:
+ requests:
+ storage: 500Mi
diff --git a/k8s/mini/kustomization.yaml b/server-product/build/k8s/mini/kustomization.yaml
similarity index 59%
rename from k8s/mini/kustomization.yaml
rename to server-product/build/k8s/mini/kustomization.yaml
index a16b850657..285b137210 100644
--- a/k8s/mini/kustomization.yaml
+++ b/server-product/build/k8s/mini/kustomization.yaml
@@ -1,4 +1,7 @@
namespace: onedev
+images:
+- name: 1dev/server
+ newTag: ${buildVersion}
bases:
- ../base
patchesStrategicMerge:
diff --git a/k8s/base/deployments.yaml b/server-product/build/k8s/production/deployments.yaml
similarity index 100%
rename from k8s/base/deployments.yaml
rename to server-product/build/k8s/production/deployments.yaml
diff --git a/server-product/build/k8s/production/disk-settings.yaml b/server-product/build/k8s/production/disk-settings.yaml
new file mode 100644
index 0000000000..850f0bfca5
--- /dev/null
+++ b/server-product/build/k8s/production/disk-settings.yaml
@@ -0,0 +1,45 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: onedev
+spec:
+ template:
+ spec:
+ containers:
+ - name: onedev
+ volumes:
+ - name: onedev
+ persistentVolumeClaim:
+ claimName: onedev
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: mysql
+spec:
+ template:
+ spec:
+ containers:
+ - name: mysql
+ volumes:
+ - name: mysql
+ persistentVolumeClaim:
+ claimName: mysql
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: onedev
+spec:
+ resources:
+ requests:
+ storage: 100Gi
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: mysql
+spec:
+ resources:
+ requests:
+ storage: 10Gi
diff --git a/k8s/production/kustomization.yaml b/server-product/build/k8s/production/kustomization.yaml
similarity index 73%
rename from k8s/production/kustomization.yaml
rename to server-product/build/k8s/production/kustomization.yaml
index 2f09f28afc..a88a03c067 100644
--- a/k8s/production/kustomization.yaml
+++ b/server-product/build/k8s/production/kustomization.yaml
@@ -3,6 +3,9 @@ bases:
- ../base
commonLabels:
app: onedev
+images:
+- name: 1dev/server
+ newTag: ${buildVersion}
patchesStrategicMerge:
- node-selectors.yaml
- memory-settings.yaml
diff --git a/k8s/production/memory-settings.yaml b/server-product/build/k8s/production/memory-settings.yaml
similarity index 100%
rename from k8s/production/memory-settings.yaml
rename to server-product/build/k8s/production/memory-settings.yaml
diff --git a/k8s/production/node-selectors.yaml b/server-product/build/k8s/production/node-selectors.yaml
similarity index 100%
rename from k8s/production/node-selectors.yaml
rename to server-product/build/k8s/production/node-selectors.yaml
diff --git a/k8s/ssl/README.md b/server-product/build/k8s/ssl/README.md
similarity index 100%
rename from k8s/ssl/README.md
rename to server-product/build/k8s/ssl/README.md
diff --git a/k8s/ssl/deployments.yaml b/server-product/build/k8s/ssl/deployments.yaml
similarity index 100%
rename from k8s/ssl/deployments.yaml
rename to server-product/build/k8s/ssl/deployments.yaml
diff --git a/k8s/ssl/kustomization.yaml b/server-product/build/k8s/ssl/kustomization.yaml
similarity index 100%
rename from k8s/ssl/kustomization.yaml
rename to server-product/build/k8s/ssl/kustomization.yaml
diff --git a/k8s/ssl/services.yaml b/server-product/build/k8s/ssl/services.yaml
similarity index 100%
rename from k8s/ssl/services.yaml
rename to server-product/build/k8s/ssl/services.yaml
diff --git a/k8s/trust-certs/README.md b/server-product/build/k8s/trust-certs/README.md
similarity index 100%
rename from k8s/trust-certs/README.md
rename to server-product/build/k8s/trust-certs/README.md
diff --git a/k8s/trust-certs/deployments.yaml b/server-product/build/k8s/trust-certs/deployments.yaml
similarity index 100%
rename from k8s/trust-certs/deployments.yaml
rename to server-product/build/k8s/trust-certs/deployments.yaml
diff --git a/k8s/trust-certs/kustomization.yaml b/server-product/build/k8s/trust-certs/kustomization.yaml
similarity index 100%
rename from k8s/trust-certs/kustomization.yaml
rename to server-product/build/k8s/trust-certs/kustomization.yaml
diff --git a/server-product/pom.xml b/server-product/pom.xml
index ffe7f71e01..58c4ef5a3f 100644
--- a/server-product/pom.xml
+++ b/server-product/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>io.onedev</groupId>
<artifactId>server</artifactId>
- <version>3.0.1</version>
+ <version>3.0.2</version>
</parent>
<dependencies>
<dependency>