标签: bitbucket-pipelines

如何使 Bitbucket Pipelines 中运行的脚本失败?

当管道运行一系列节点命令时,如何在管道内触发失败?

我已经尝试过以下方法:

const failBuild = function(message) {
  console.error('Deploy failed: ', message)
  throw new Error('Deploy failed')
}
Run Code Online (Sandbox Code Playgroud)

我看到“部署失败”消息,但管道仍然显示“成功”。

bitbucket bitbucket-pipelines

4
推荐指数
1
解决办法
8677
查看次数

Bitbucket 管道无法推送到 heroku

我确实有一个react.js应用程序(create-react-app)我设置了文件,就像官方文档中解释的那样,一切都很顺利,但推送失败了这一特定行

git Push https://heroku :$API_KEY@git.heroku.com/$APP_NAME.git HEAD:master

bitbucket-pipelines.yml 位于根文件夹中:

image: node:6
clone:
  depth: full
pipelines:
  default:
    - step:
        script:
          - npm install
          - npm test
          - git push git push https://heroku:$API_KEY@git.heroku.com/$APP_NAME.git HEAD:master
Run Code Online (Sandbox Code Playgroud)

我做错了什么?这里的目标是在 bitbucket 平台上使用 CI,同时还将主提交推送到 heroku 存储库以自动部署。

我收到的错误是:

remote: !   WARNING:
remote: !   Do not authenticate with username and password using git.
remote: !   Run `heroku login` to update your credentials, then retry the git command.
remote: !   See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://heroku
Run Code Online (Sandbox Code Playgroud)

git reactjs bitbucket-pipelines

4
推荐指数
1
解决办法
1341
查看次数

How to locate apk file using bitbucket-pipelines?

I'm using BitBucket-pipelines for Android CI. I'm trying to export the artifact (generated apk) to the downloads section of the project.

My bitbucket-pipelines.yml is as follows, but it can't locate the apk file

image: openjdk:8

pipelines:
default:
- step:
    caches:
      - gradle
      - android-sdk

    script:
      # Download and unzip android sdk
      - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
      - unzip -o -qq android-sdk.zip -d android-sdk

      # Define Android Home and add PATHs
      - export ANDROID_HOME="/opt/atlassian/pipelines/agent/build/android-sdk"
      - export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH"

      # Download packages.
      - …
Run Code Online (Sandbox Code Playgroud)

continuous-integration android bitbucket devops bitbucket-pipelines

4
推荐指数
1
解决办法
2439
查看次数

使用 Java 11 运行 SonarScanner 分析,使用 Java 8 运行目标代码

正如以下公告所指出的,SonarSource 终止了对使用 11 版之前的 Java 版本运行代码分析器的支持:

2021 年 1 月 - 将分析移至 Java 11

扫描仪环境中安装的 Java 版本必须在 2021 年 2 月 1 日之前至少升级到 Java 11。Java 11 之前的版本已被弃用,使用它们的扫描仪将在该日期停止运行。

此外,2021 年 1 月 11 日至 2021 年 1 月 15 日期间将会出现限电,在此期间,使用低于 11 的 Java 版本的扫描仪运行的首次分析将失败。为了避免这种不便,您应该在 2021 年 1 月 11 日之前升级。

这里讨论的 Java 安装特指在运行 SonarCloud 扫描仪分析工具的上下文中安装和使用的 JDK 或 JRE。这可能是您本地的构建环境或您的 Cl 服务。

这不会对项目代码所针对的 Java 版本产生任何影响。您仍然可以分析目标版本低于 11 的 Java 项目。

我尝试搜索有关如何运行 bitbucket 管道以使用 java 11 分析器执行 SonarScanner 分析的完整示例,但目标代码使用 java 11 之前的版本(例如 java …

java sonarqube bitbucket-pipelines sonarcloud java-11

4
推荐指数
1
解决办法
1万
查看次数

从 Bitbucket 管道中的 Java Maven 项目的 pom.xml 获取版本

有没有办法获取 pom.xml 文件中定义的版本,以便它可以与 Bitbucket 管道中的变量一起使用?

StackOverflow 上也有类似的问题,但它们主要指的是 Jenkins 和“readMavenPom”,这在 Bitbucket 管道中似乎不可用。

我想用它作为第二步上传到S3的版本标签。

- step:
    name: Build and Test
    caches:
      - maven
    script:
      - mvn package
    artifacts:
      - target/myapp-*.jar
- step:
    name: Upload to S3
    deployment: production
    script:
      - pipe: atlassian/aws-code-deploy:0.2.10
        variables:
          AWS_DEFAULT_REGION: $AWS_REGION
          AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
          AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
          COMMAND: 'upload'
          APPLICATION_NAME: 'myapp'
          ZIP_FILE: "target/myapp-*.jar"
          S3_BUCKET: 'myapps'
          VERSION_LABEL: "myapp-${version}-${BITBUCKET_COMMIT:0:8}"
Run Code Online (Sandbox Code Playgroud)

java maven bitbucket-pipelines bitbucket-aws-code-deploy

4
推荐指数
1
解决办法
3254
查看次数

我应该在构建步骤中使用`git push --force`

我有一个bitbucket repo,它使用bitbucket-pipelines部署到azure上的本地存储库(对于我们的开发服务器).我正在研究管道在部署到azure之前将使用的构建步骤.我的构建步骤现在唯一能做的就是将构建的文件输出到给定的目录中,该目录是gitignored.然后强制添加gitignored构建文件夹.然后它修改了触发管道的提交,最后强制将提交推送到master.

所以我的文件看起来像这样

# bitbucket decided to make the repository shallow this line
# makes the repo unshallow so we can push later
- git fetch  https://<bitbucket-repo> --unshallow
# doing some setup so we can run the build scripts
- npm install
- npm install -g gulp
# just building files for now we can add tests in later
- npm run build:single
# forcing the build files to be included in the commit
# so that azure has access …
Run Code Online (Sandbox Code Playgroud)

git continuous-integration build azure bitbucket-pipelines

3
推荐指数
1
解决办法
475
查看次数

序列条目位桶管道的错误缩进

我目前在 bitbucket 管道中有一个步骤可以做一些事情。最后一步是启动 aws ecs 任务,如下所示:

  - step:
      name: Migrate database
      script:
        - curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
        - apt-get update
        - apt-get install -y unzip python
        - unzip awscli-bundle.zip
        - ./awscli-bundle/install -b ~/bin/aws
        - export PATH=~/bin:$PATH
        - aws ecs run-task --cluster test-cluster --task-definition test-task --overrides '{ "containerOverrides": [ { "name": "test-container", "command": [ "echo", "hello world" ], "environment": [ { "name": "APP_ENV", "value": "local" } ] } ] }' --network-configuration '{ "awsvpcConfiguration": { "subnets": ["subnet-xxxxxxx"], "securityGroups": ["sg-xxxxxxx"], "assignPublicIp": "ENABLED" }}' …
Run Code Online (Sandbox Code Playgroud)

yaml bitbucket-pipelines

3
推荐指数
1
解决办法
1万
查看次数

Bitbucket 管道部署忽略使用 ftp 上传的供应商文件夹

我正在尝试使用 bitbucket 管道部署 PHP 项目。有了这个代码:

init: # -- First time init
  - step:
      name: build
      image: php:7.1.1
      caches:
        - composer
      script:
        - apt-get update && apt-get install -y unzip
        - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
        - composer install
        - vendor/bin/phpunit
      artifacts: # defining vendor/ as an artifact
        - vendor/**
  - step:
      image: samueldebruyn/debian-git
      name: deployment
      script:
        - apt-get update
        - apt-get -qq install git-ftp
        - git ftp init -u "$FTP_DEV_USERNAME" -p "$FTP_DEV_PASSWORD" ftp://$FTP_DEV_HOST/$FTP_DEV_FOLDER
Run Code Online (Sandbox Code Playgroud)

但它忽略了供应商文件夹。我假设,工件也会添加此文件夹来部署。

有什么问题或者我可以做得更好吗?

php deployment bitbucket composer-php bitbucket-pipelines

3
推荐指数
1
解决办法
1428
查看次数

当 serverless.yml 文件存在时,无服务器配置凭据不起作用

我们尝试在 BitBucket 管道上使用无服务器方式部署 lambda,但在运行命令时遇到了问题serverless config credentials。这个问题也发生在 docker 容器和我们本地的机器上。

这是我们正在运行的命令:

serverless config credentials --stage staging --provider aws --key $AWS_ACCESS_KEY --secret $AWS_ACCESS_SECRET
Run Code Online (Sandbox Code Playgroud)

它给了我们错误:

Error: Profile default does not exist
Run Code Online (Sandbox Code Playgroud)

该配置文件在我们的 serverless.yml 文件中定义。如果我们在运行命令之前重命名 serverless 文件,它就会起作用,然后我们可以将 serverless.yml 文件放回去并成功部署。

例如

            - mv serverless.yml serverless.old
            - serverless config credentials --stage beta --provider aws --key $AWS_ACCESS_KEY --secret $AWS_ACCESS_SECRET
            - mv serverless.old serverless.yml
Run Code Online (Sandbox Code Playgroud)

我们尝试--profile default在那里添加开关,但没有什么区别。

值得注意的是,直到我们开始在无服务器文件中使用 SSM 参数存储之前,这并不是一个问题,当我们添加它时,它就开始给我们带来错误Profile default does not exist

serverless.yml(部分)

service: our-service

provider:
  name: aws
  runtime: nodejs12.x
  region: eu-west-1 …
Run Code Online (Sandbox Code Playgroud)

aws-lambda bitbucket-pipelines serverless

3
推荐指数
1
解决办法
1万
查看次数

我可以从 bitbucket 管道中的其他管道执行管道吗?

我在 bitbucket 管道中有两个存储库,都启用了管道。

另一个管道完成后如何执行管道?

pipeline bitbucket bitbucket-pipelines

3
推荐指数
2
解决办法
2522
查看次数