简体   繁体   English

Bitbuckets Pipelines 创建一个具有并行步骤的步骤

[英]Bitbuckets Pipelines create a step with parallel steps

I want to have one step, that will setup everything and then in parallel run other steps.我想要一个步骤,它将设置所有内容,然后并行运行其他步骤。 Currently I have something like this:目前我有这样的事情:

image: python:3.9.16-alpine

pipelines:
  default:
    - step:
        runs-on:
          - self.hosted
          - regressiontests
        name: First Step
        clone:
          enabled: false
        caches:
          - pip
        script:
          - apk add git
          - apk add openssh-client
          - git clone myrepository.git
          - pip install -r myrepository/requirements.txt
          - echo $ENV_FILE | base64 -d -i > myrepository/.env
        artifacts:
          - myrepository/**
    - step:
        runs-on:
          - self.hosted
          - regressiontests
        name: Second Step
        clone:
          enabled: false
        caches:
          - pip
        script:
            - cd myrepository
            - pip install -r requirements.txt
        parallel:
          - step:
              name: Step 2.1
              script:
                - python fancy command 1
          - step:
              name: Step 2.2
              script:
                - python fancy command 2
          - step:
              name: Step 2.3
              script:
                - python fancy command 3
          - step:
              name: Step 2.4
              script:
                - python fancy command 4

But the only steps that I see is First Step and Second Step none of parallel steps is executed in pipelines但是我看到的唯一步骤是第一步和第二步没有并行步骤在管道中执行在此处输入图像描述

  1. That's not the correct syntax for parallel steps.这不是并行步骤的正确语法。 Checkout https://support.atlassian.com/bitbucket-cloud/docs/set-up-or-run-parallel-steps/结帐https://support.atlassian.com/bitbucket-cloud/docs/set-up-or-run-parallel-steps/
image: python:3.9.16-alpine

pipelines:
  default:
    - step:
        name: First Step
        script: []
    - step:
        name: Second Step
        script: []
    - parallel:
      - step:
          name: Step 3.1
          script: []
      - step:
          name: Step 3.2
          script: []
      # ...

This what I think you are trying to achieve这就是我认为你正在努力实现的目标

BUT

  1. Each step script happens in a new pristine docker container, so any setup must happen in the same script where the software will be used.每个步骤脚本都发生在一个新的原始 docker 容器中,因此任何设置都必须发生在将使用该软件的同一脚本中。

Therefore I am afraid your whole effort to speed up your steps setup is futile.因此,恐怕您为加快步骤设置所做的全部努力都是徒劳的。

Instead, you'd like to tune your caches.相反,您想调整缓存。 For python you may want to cache both ~/.cache/pip and a virtualenv so that pip install -r... instructions are sped up.对于 python,您可能希望同时缓存~/.cache/pip和 virtualenv,以便加快pip install -r...指令的速度。

Plus, I have a feeling that bitbucket artifacts are quite slow so I'd expect disabling the repository clone in every step to be actually slower.另外,我觉得 bitbucket 工件非常慢,所以我希望在每个步骤中禁用存储库克隆实际上会更慢。 I'd use a shallow clone instead with我会使用浅克隆代替

clone:
  depth: 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bitbucket管道 - 具有相同步骤的多个分支 - Bitbucket Pipelines - multiple branches with same steps Azure管道构建可视步骤而不是我的.yml文件 - Azure Pipelines builds visual steps not my .yml file 更改 Azure 管道 YAML 中所有步骤的工作目录 - Changing the working directory for all steps in Azure Pipelines YAML 将参数发送到 yml 锚点以获取 bitbucket-pipelines.yml 中的一个步骤 - Send argument to yml anchor for a step in bitbucket-pipelines.yml [管道 > 步骤 > 条件] 处的 bitbucket-pipelines.yml 错误。 准确地说:至少需要一个条件 - error in bitbucket-pipelines.yml at [pipelines > step > condition]. To be precise: At least one condition is required Azure 管道,如何创建发行说明 - Azure pipelines, how to create release notes 如何在 bitbucket-pipelines.yml 文件的同一步骤中构建和部署 jar? - How to build and deploy jar in same step in bitbucket-pipelines.yml file? 是否每个bash步骤创建一个新的shell环境? - Is each bash step create a new shell environment? Azure 管道 - Azure pipelines 为 Azure DevOps 管道中的测试用例创建特定工作项(Bug)--Selenium - Create a specific work item (Bug) for test case in Azure DevOps pipelines--Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM