我有一个大厅管道:
groups: []
resources:
- name: source-code
type: git
resource_types: []
jobs:
- name: build
public: true
plan:
- get: source-code
- task: build
privileged: true
config:
platform: linux
image_resource:
type: docker-image
source:
repository: java
tag: openjdk-8-alpine
run:
path: sh
args:
- -exc
- |
set -e -u -x
MVN_VERSION=$(cat pom.xml | grep "^ <version>.*</version>$" | awk -F'[><]' '{print $3}')
**CUSTOM_VERSION = [POM_FILE_VERSION]-build.[NO_OF_COMMITS_IN_BRANCH]**
inputs:
- name: source-code
使用 Unix 命令,我想创建自定义版本:
CUSTOM_VERSION = [POM_FILE_VERSION]-build.[NO_OF_COMMITS_IN_BRANCH]
对于[POM_FILE_VERSION],我找到了代码:
MVN_VERSION=$(cat pom.xml | grep "^ <version>.*</version>$" | awk -F'[><]' '{print $3}')
但是对于[NO_OF_COMMITS_IN_BRANCH],我不知道如何从 git 资源中获取该数据。任何人都可以帮忙吗?