Giter Site home page Giter Site logo

yml 全局变量? about docs HOT 9 OPEN

flowci avatar flowci commented on August 28, 2024
yml 全局变量?

from docs.

Comments (9)

yunheli avatar yunheli commented on August 28, 2024 1

@sdaduanbilei 把变量 GIT_COMMIT_LOG 改为 ANDORID_OUTPUT_GIT_COMMIT_LOG

from docs.

yunheli avatar yunheli commented on August 28, 2024

这个配置FLOW_ENV_OUTPUT_PREFIX: ANDORID_OUTPUT_ 意思是只共享前缀是 ANDROID_OUTPUT_的环境变量

from docs.

sdaduanbilei avatar sdaduanbilei commented on August 28, 2024

@yunheli 成功了
但是为什么得这样写?
还有第一步是不是可以实现,检测到commit 和上一次不相同了 我在 进行全部流程的编译 上传, 如果相同 我就直接结束, Webhook 由于是台物理机只能局域网使用,我现在是 定时检测

from docs.

yunheli avatar yunheli commented on August 28, 2024

@sdaduanbilei
第一个问题:环境变量太多,所以只能存一些指定的环境变量,因为这些环境变量要入库
第二个问题:你把上次最新的commit写到一个文件,下次编译的时候读一下文件的上次保存的commit 不同的话就继续

from docs.

yunheli avatar yunheli commented on August 28, 2024

至于环境变量的前缀是什么可以自己定义

from docs.

sdaduanbilei avatar sdaduanbilei commented on August 28, 2024

@yunheli 如何结束 停止不进行往下走呢? exit 好像不管用!

from docs.

sdaduanbilei avatar sdaduanbilei commented on August 28, 2024

@yunheli

flow:
  - envs:
        FLOW_AGENT_WORKSPACE: ${HOME}/agent-workspace
        FLOW_ENV_OUTPUT_PREFIX: ANDORID_OUTPUT_
        ANDROID_GRADLE_BUILD_TASK: assembleRelease
        ANDROID_PROJECT_NAME: youprojectname
    steps:
      - name: Git Clone #rm -r -f 每次都会删除项目,重新clone
        script: |
          rm -r -f ${ANDROID_PROJECT_NAME} 
          export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
          git clone --branch ${FLOW_GIT_BRANCH} --single-branch ${FLOW_GIT_URL} ${ANDROID_PROJECT_NAME}
          cd ${ANDROID_PROJECT_NAME}
          export GIT_COMMIT_ID=`git rev-parse HEAD` # 获取最后一个 commit id
          export ANDORID_OUTPUT_GIT_COMMIT_LOG=`git log -1`
          COMMIT_PAHT=${HOME}/${ANDROID_PROJECT_NAME}.txt
          echo current git log:${ANDORID_OUTPUT_GIT_COMMIT_LOG}

          if [ -f "${COMMIT_PAHT}" ] # 判断文件是否存在
            then
              cat ${COMMIT_PAHT} | while read LINE # 读取本地的commit id
              do 
                if [[ ${LINE} == ${GIT_COMMIT_ID} ]]
                  then
                    rm -r -f ${ANDROID_PROJECT_NAME}
                    echo Everything up-to-date
                    [["]]
                    exit
                  else
                    echo ${GIT_COMMIT_ID} > ${COMMIT_PAHT} # 以项目名,保存commit id到本地
                fi
              done
            else
              echo ${GIT_COMMIT_ID} > ${COMMIT_PAHT} # 以项目名,保存commit id到本地
          fi
      - name: QQBOT ## qq 机器人发送通知消息
        script: |
            echo ${ANDORID_OUTPUT_GIT_COMMIT_LOG}

已经实现commit 版本对比,成功输入 Everything up-to-date 但是执行 exit 后 还是会继续下面的 step 要如何停止呢

在线急等

from docs.

sdaduanbilei avatar sdaduanbilei commented on August 28, 2024

@yunheli

Everything up-to-date
/bin/bash:行19: [[]]: 未找到命令

我目前在 这里写上一个 错误的命令,然后让整个过程出错!
issues 我先开着

from docs.

yunheli avatar yunheli commented on August 28, 2024

@sdaduanbilei 可以看文档 有 condition 条件比较

from docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.