一、注意点
其实下文二的image是基于这个镜像作为基础镜像在这个镜像中执行打包,shellScript 当前路径是你代码块与上图settings.xml,图中的settings.xml可以替换下你当前镜像的settings.xml
示例
二、.rancher-pipeline.yml
${CICD_GIT_BRANCH}这些从官网可以看到对应的参数解释
stages:
- name: 扫描+编译steps:- runScriptConfig:image: zhang2035005702/maven-jdk:v1.8shellScript: |-mvn clean install -DskipTests=true -T 2.0C
- name: 网关镜像打包steps:- publishImageConfig:dockerfilePath: ./Dockerfile-GW # 这是dockerfile的路径buildContext: .tag: shop/gw:${CICD_GIT_BRANCH}-${CICD_GIT_COMMIT}#(可选项)推送镜像到远程镜像库pushRemote: trueregistry: xxxx.comenv:PLUGIN_DEBUG: "true"PLUGIN_INSECURE: "true"
- name: 认证组件镜像打包steps:- publishImageConfig:dockerfilePath: ./Dockerfile-AUTHbuildContext: .tag: shop/auth:${CICD_GIT_BRANCH}-${CICD_GIT_COMMIT}pushRemote: trueregistry: xxxx.comenv:PLUGIN_DEBUG: "true"PLUGIN_INSECURE: "true"
- name: 应用发布steps:- applyYamlConfig:path: ./deployment.yaml
timeout: 60
notification: {}