https://github.com/kubesphere/devops-agent

https://github.com/kubesphere/devops-agent/blob/v3.2.2/base/hack/install_utils.sh
v3.22 版本基础镜像添加kustomize v4.5.3

gradle jenkins-salve镜像

github仓库下载文件

  1. [root@ur-test-docker builder-gradle]# ls -l
  2. total 8
  3. -rw-r--r-- 1 root root 771 Jun 15 09:27 Dockerfile
  4. -rwxr-xr-x 1 root root 520 Jun 15 10:05 set_java
  5. [root@ur-test-docker builder-gradle]#

set_java 脚本赋予执行权限

  1. chmod +x set_java
  1. docker build -t kubespheredev/builder-gradle .
  2. docker push kubespheredev/builder-gradle:latest

本地文件 android-sdk_r24.4.1-linux.tar

  1. FROM kubespheredev/builder-base:v3.1.0
  2. # Installs i386 architecture required for running 32 bit Android tools
  3. RUN yum install -y glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686 && \
  4. yum clean all -y
  5. # Installs Android SDK
  6. ENV ANDROID_SDK_FILENAME android-sdk_r24.4.1-linux.tar
  7. ENV ANDROID_SDK_URL http://dl.google.com/android/${ANDROID_SDK_FILENAME}
  8. ENV ANDROID_API_LEVELS android-21,android-27,android-28,android-29,android-30,android-31,android-32
  9. ENV ANDROID_BUILD_TOOLS_VERSION 32.0.0
  10. ENV ANDROID_HOME /tmp/android-sdk-linux
  11. ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/build-tools/build-tools-${ANDROID_BUILD_TOOLS_VERSION}
  12. COPY ./android-sdk_r24.4.1-linux.tar /tmp
  13. RUN cd /tmp && \
  14. tar -xzf ${ANDROID_SDK_FILENAME} && \
  15. rm ${ANDROID_SDK_FILENAME} && \
  16. echo y | android update sdk --no-ui -a --filter tools,platform-tools,${ANDROID_API_LEVELS},build-tools-${ANDROID_BUILD_TOOLS_VERSION}
  17. # java
  18. ENV JAVA_VERSIOIN 11
  19. RUN yum install -y java-${JAVA_VERSIOIN}-openjdk-devel java-${JAVA_VERSIOIN}-openjdk-devel.i686 && \
  20. yum -y clean all
  21. # gradle7
  22. ENV GRADLE_VERSION 7.0.2
  23. ENV GRADLE_HOME /usr/local/gradle-${GRADLE_VERSION}
  24. ENV PATH ${GRADLE_HOME}/bin:$PATH
  25. RUN curl -fSL https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -o gradle.zip && \
  26. echo "$(curl -sLf https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip.sha256) gradle.zip" | sha256sum --check && \
  27. unzip -q gradle.zip -d /usr/local && \
  28. rm -f gradle.zip
  29. # Set JDK to be 32bit
  30. COPY set_java $GRADLE_HOME
  31. RUN $GRADLE_HOME/set_java && \
  32. rm -f $GRADLE_HOME/set_java
  33. ENV PATH ${PATH}:${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS_VERSION}
  34. CMD ["gradle","--version"]

kubesphere配置

jenkins配置

  1. 配置字典页面的搜索框中输入 jenkins-casc-config 并按回车键
  2. 点击 jenkins-casc-config 进入其详情页面,点击更多操作,选择编辑 YAML
  1. sh-4.2# gradle -h
  2. USAGE: gradle [option...] [task...]
  3. -?, -h, --help Shows this help message.
  4. -a, --no-rebuild Do not rebuild project dependencies.
  5. -b, --build-file Specify the build file.
  6. --build-cache Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.
  7. -c, --settings-file Specify the settings file.
  8. --configuration-cache Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds. [incubating]
  9. --configuration-cache-problems Configures how the configuration cache handles problems (fail or warn). Defaults to fail. [incubating]
  10. --configure-on-demand Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. [incubating]
  11. --console Specifies which type of console output to generate. Values are 'plain', 'auto' (default), 'rich' or 'verbose'.
  12. --continue Continue task execution after a task failure.
  13. -D, --system-prop Set system property of the JVM (e.g. -Dmyprop=myvalue).
  14. -d, --debug Log in debug mode (includes normal stacktrace).
  15. --daemon Uses the Gradle Daemon to run the build. Starts the Daemon if not running.
  16. --export-keys Exports the public keys used for dependency verification.
  17. -F, --dependency-verification Configures the dependency verification mode (strict, lenient or off)
  18. --foreground Starts the Gradle Daemon in the foreground.
  19. -g, --gradle-user-home Specifies the gradle user home directory.
  20. -I, --init-script Specify an initialization script.
  21. -i, --info Set log level to info.
  22. --include-build Include the specified build in the composite.
  23. -M, --write-verification-metadata Generates checksums for dependencies used in the project (comma-separated list)
  24. -m, --dry-run Run the builds with all task actions disabled.
  25. --max-workers Configure the number of concurrent workers Gradle is allowed to use.
  26. --no-build-cache Disables the Gradle build cache.
  27. --no-configuration-cache Disables the configuration cache. [incubating]
  28. --no-configure-on-demand Disables the use of configuration on demand. [incubating]
  29. --no-daemon Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.
  30. --no-parallel Disables parallel execution to build projects.
  31. --no-scan Disables the creation of a build scan. For more information about build scans, please visit https://gradle.com/build-scans.
  32. --no-watch-fs Disables watching the file system.
  33. --offline Execute the build without accessing network resources.
  34. -P, --project-prop Set project property for the build script (e.g. -Pmyprop=myvalue).
  35. -p, --project-dir Specifies the start directory for Gradle. Defaults to current directory.
  36. --parallel Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.
  37. --priority Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low'
  38. --profile Profile build execution time and generates a report in the <build_dir>/reports/profile directory.
  39. --project-cache-dir Specify the project-specific cache directory. Defaults to .gradle in the root project directory.
  40. -q, --quiet Log errors only.
  41. --refresh-dependencies Refresh the state of dependencies.
  42. --refresh-keys Refresh the public keys used for dependency verification.
  43. --rerun-tasks Ignore previously cached task results.
  44. -S, --full-stacktrace Print out the full (very verbose) stacktrace for all exceptions.
  45. -s, --stacktrace Print out the stacktrace for all exceptions.
  46. --scan Creates a build scan. Gradle will emit a warning if the build scan plugin has not been applied. (https://gradle.com/build-scans)
  47. --status Shows status of running and recently stopped Gradle Daemon(s).
  48. --stop Stops the Gradle Daemon if it is running.
  49. -t, --continuous Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.
  50. --update-locks Perform a partial update of the dependency lock, letting passed in module notations change version. [incubating]
  51. -v, --version Print version info.
  52. -w, --warn Set log level to warn.
  53. --warning-mode Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none'
  54. --watch-fs Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.
  55. --write-locks Persists dependency resolution for locked configurations, ignoring existing locking information if it exists
  56. -x, --exclude-task Specify a task to be excluded from execution.
  57. sh-4.2#

https://docs.gradle.org/7.5/userguide/publishing_maven.html