代码之家  ›  专栏  ›  技术社区  ›  djna

gitpod预构建和测试gitpod.yml

  •  0
  • djna  · 技术社区  · 4 年前

    由两部分组成的问题:

    1. 我尝试使用gitpod预构建是否正确?
    2. 如何测试我对.gitpod.yml的更改?我希望步骤何时运行,我希望看到什么输出?

    我的计划是在我的git存储库中有几个分支,同事们正在处理几个问题。我想设置他们的初始环境。我知道有些事情需要在docker映像中完成,有些事情可以在.gitpod.yml中指定——这里的重点是我在预构建中可以做什么。

    所以我创建了一个分支,并在其中更新我的基本.gitpod.yml

    ports:
      - port: 3000
    github:
      prebuilds:
        # enable for the default branch (defaults to true)
        master: true
        # enable for all branches in this repo (defaults to false)
        branches: true
        # enable for pull requests coming from this repo (defaults to true)
        pullRequests: true
        # enable for pull requests coming from forks (defaults to false)
        pullRequestsFromForks: false
        # add a check to pull requests (defaults to true)
        addCheck: true
        # add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
        addComment: false
        # add a "Review in Gitpod" button to the pull request's description (defaults to false)
        addBadge: true
    

    我相信我已经启用了gitpod构建:

    gitpod extension

    然后,我尝试在预构建中添加一些琐碎的工作(最终我想做一些更有用的事情,比如在一个窗格中启动nodeexpress)。

    github:
      prebuilds:
         master: true
         # etc ... lines elided
         tasks:
         - name: "Lefty"
           command: echo 'left'
         - name: "Dexter"
           command: echo 'right'
           openMode: split-right
    

    我查了一下零钱,然后推到分行。我的期望是,在某个时候,我会看到一个带有一些回声文本的拆分终端窗口。

    我不清楚工作空间的生命周期应该在什么时候发生。我尝试过这个序列:

    1. 推送更新的.gitpod.yml
    2. 关闭工作区,删除工作区
    3. 从分支URL创建新工作区

    这带来了一个带有更新的.gitpod.yml的新工作区,但我看不到预构建的证据。我欢迎再教育;-)

    0 回复  |  直到 4 年前
        1
  •  1
  •   djna    4 年前

    我误解了.gitpod.yml语法,tasks部分应该位于顶层,而不是像我所说的那样位于预构建之下。

    github:
       prebuilds:
         master: true
         # etc ... lines elided
    tasks:
        - name: "Lefty"
          before: |
              echo "In $(pwd)"
          init: |
              echo "Could npm install here"
          command: |
              echo 'left'
        - name: "Dexter"
          command: |
              echo 'right'
          openMode: split-right
    

    我将重组后的.gitpod.yml文件检查为git,启动了一个新的工作区,并看到脚本在拆分的窗口中运行。

    带走的想法是 任务 节与您正在使用的特定git无关;就我而言 github stanza确定before、init和命令脚本的运行时间。

    推荐文章