首页 > 解决方案 > 带有正则表达式的 grep 命令在 gitlab ci 上不起作用

问题描述

我在我的 gitlab ci 中运行脚本:

pre_build:
  stage: get_info
  script:
    - printenv
    - cd ./scripts
    - ./pre_build.sh

该脚本具有以下行:

todays_date=$(date +"%d-%b-%Y")
latest=$(curl -i ${artifactory_url} | grep develop | grep -i ${todays_date} | grep ${last_ok_build_number} | grep -Eoi '<a [^>]+>' | grep -Eo 'href="[^\"]+"')

我相信这是由于 grep 中的正则表达式而失败的,知道如何在 GitLab ci 中运行它吗?上面的脚本在我的本地机器上运行良好

编辑:上面的代码是时区问题

标签: grepgitlab-ci

解决方案


推荐阅读