标签: bitbucket-pipelines

Typescript 无法仅找到 CI 类

我有一个Angular项目,当我在本地运行“ng test”时,一切正常,但是在 bitbucket 管道中我遇到了这个错误。

src/app/services/user-store/user.service.ts:7:22 中出现错误 - 错误 TS2307:找不到模块“../../models/user”或其相应的类型声明。7 从 '../../models/user' 导入 { User };

我的 tsconfig.base

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我的 tsconfig.spec.json

{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/spec",
    "types": [
      "jasmine"
    ]
  },
  "files": [
    "src/test.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.spec.ts",
    "src/**/*.d.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我认为与我的 tsconfig.base 中的“目标”相关,但我不确定,也许我的 yaml …

pipeline bitbucket ecmascript-5 typescript bitbucket-pipelines

6
推荐指数
0
解决办法
665
查看次数

BitBucket Pipelines 无法构建生产 Angular 代码(暂存和本地机器工作)

我正在使用 BitBucket Pipelines 尝试自动部署暂存和生产编译的代码。暂存工作正常,生产工作在我的本地服务器上工作正常,但在管道上则不然。失败的日志如下,我不知道为什么会失败:

"build:prod": "ng build --prod"

+ npm run build:prod
> mobile-app@1.1.2 build:prod /opt/atlassian/pipelines/agent/build
> ng build --prod
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
<--- Last few GCs --->
[67:0x3002f10]   220826 ms: Mark-sweep 2014.9 (2069.4) -> 2004.8 (2071.6) MB, 908.6 / 0.1 ms  (average mu = 0.172, current mu = 0.096) allocation failure scavenge might not succeed
[67:0x3002f10]   222095 ms: Mark-sweep 2016.7 (2071.6) -> 2011.3 (2074.4) MB, 1215.6 / 0.1 ms  (average mu = …
Run Code Online (Sandbox Code Playgroud)

angular-cli bitbucket-pipelines

6
推荐指数
1
解决办法
3499
查看次数

配置 bitbucket-pipeline.yml 以在运行管道时使用存储库中的 DockerFile 来构建映像

我是在 bitbucket 上创建管道以在合并后自动构建特定分支的新手。该项目是用C++编写的,具有以下结构:

PROJECT FOLDER
    - .devcontainer/
        - devcontainer.json
    - bin/
    - doc/
    - lib/
    - src/
        - CMakeLists.txt
        - ...
    - CMakeLists.txt
    - clean.sh
    - compile.sh
    - configure.sh
    - DockerFile
    - bitbucket-pipelines.yml
Run Code Online (Sandbox Code Playgroud)

我们创建了一个 DockerFile,其中包含构建项目所需的所有设置。有什么方法可以将 bitbucket-pipeline.yml 上的 docker 映像从存储库引用到 DockerFile 吗?

我已经能够将 docker 映像上传到我的 docker hub 上,并通过定义以下内容将其与我的凭据一起使用:

image:
  name: <dockerhubname>/<dockername>
  username: $DOCKER_HUB_USERNAME
  password: $DOCKER_HUB_PASSWORD
  email: $DOCKER_HUB_EMAIL
Run Code Online (Sandbox Code Playgroud)

但我不确定如何执行此操作,bitbucket 从存储库中获取 DockerFile 并使用它来构建映像,如果这样做,构建时间将会增加。

提前致谢!

bitbucket docker bitbucket-pipelines

6
推荐指数
1
解决办法
4541
查看次数

Bitbucket Pipelines 访问其他节点存储库

我在我的 node.js 存储库之一中启用了 Bitbucket Pipelines,让它在每次提交时运行构建。我的存储库依赖于另一个 node.js 存储库。对于开发,我使用npm link.

我已经尝试了文件中git clone指定的那个存储库bitbucket-pipelines.yml,但是构建被该命令卡住了。我想这是因为 git 在那时要求进行身份验证。

有没有办法允许容器访问同一团队中的其他存储库?或者有没有更好的方法来解决这个问题?如果 Bitbucket Pipelines 不能做到这一点,我也可以切换到另一个 CI 工具——唯一的要求是它对小于 5 人的团队免费。

顺便提一句。如果可能,我想避免为 npm 私有包付费。

谢谢!

bitbucket node.js npm bitbucket-pipelines

5
推荐指数
1
解决办法
3114
查看次数

如何在 Bitbucket Pipeline 中执行步骤之前添加等待时间

我有一个 Bitbucket 管道,它使用 cloudformation 创建 AWS 资源并将网站部署到其中。但即使 cloudform 正确创建堆栈,部署也会失败。我认为问题是当部署发生时,cloudformation S3 存储桶创建可能尚未完成。

我有一个 Hugo 网站,并且创建了一个 bitbucket 管道以将其部署到服务器。它的作用是使用 cloudformation 创建 S3 存储桶来托管网站,然后将 Hugo 网站上传到其中。当我在终端中手动运行管道中的步骤并在每个步骤之间有延迟时,它会成功发生。但是当它发生在 Bitbucket 管道上时,它会给出错误,指出我尝试上传内容的 S3 存储桶不可用。当我检查 AWS 时,该存储桶实际上就在那里。这意味着 Cloudformation 已正常工作。但是当文件开始复制时,存储桶可能无法用于上传文件。这是我的假设。有没有解决这个问题的方法。在本地执行此操作时,我可以在 cloudformation 创建和文件复制这两个命令之间等待。但是在Bitbucket pipeline环境下如何处理呢。以下是我的管道代码。

pipelines:
  pull-requests:
    '**':
      - step:
          script:
            - aws cloudformation create-stack --stack-name demo-web --template-body file://cloudformation.json --parameters ParameterKey=S3BucketName,ParameterValue=demo-web
            - hugo
            - aws s3 cp public/ s3://demo-web/ --recursive

Run Code Online (Sandbox Code Playgroud)

如何以正确的方式处理这种情况。对于这种情况有解决方法吗?或者我发现的问题并不是实际问题。

bitbucket amazon-web-services aws-cloudformation devops bitbucket-pipelines

5
推荐指数
1
解决办法
5777
查看次数

如何通过 bitbucket-hook 将 crumb 信息传递给 jenkins?

curl -X POST http://xxx.yyy.zzz:5555/job/job-name/build --user john-devops-jenkins:11df3ed41129c5c7da1518e9c3149896de -H 'Jenkins-Crumb:31827a74a160347a641c87ddbc8e3b6e'
Run Code Online (Sandbox Code Playgroud)

上面带有 post 请求的卷曲代码在触发 Jenkins 构建方面绝对工作得很好。

尝试过:

错误:No valid crumb was included in the request

仍然不走运,如何配置 bitbucket hook 到 crumb 的容器头信息或如何通过 url 传递它而不依赖第三方插件?

bitbucket jenkins devops bitbucket-pipelines

5
推荐指数
1
解决办法
5665
查看次数

EC2 安全组中的 Bitbucket IP 白名单

我想通过将 Bitbucket IP 添加到 EC2 实例的安全组来将其列入白名单。

我已按照链接上的步骤操作: https ://bitbucket.org/blog/new-ip-addresses-bitbucket-cloud

我添加了以下IP:

IPv4:18.205.93.0/25、18.234.32.128/25 和 13.52.5.0/25

但 Bitbucket 管道仍然无法连接到 EC2 实例。

有人可以帮我吗?

bitbucket amazon-ec2 bitbucket-pipelines

5
推荐指数
1
解决办法
5145
查看次数

如何跳过拉取请求的默认管道?

在我目前正在进行的项目中,我想根据以下规则运行bitbucket管道。

  • 应该为推送到分支的每个提交运行测试和 lint 步骤。
  • 必须为使用 Pull 请求打开的每条记录运行测试覆盖率和 lint 步骤。

这里的问题是,如果我将提交推送到已打开拉取请求的分支,则管道会被触发两次。

pipelines:
  default:
    - step: *lint
    - step: *test
  pull-requests:
    '**':
      - step: *lint
      - step: *test-with-coverage
Run Code Online (Sandbox Code Playgroud)

我寻找一种在拉取请求存在时跳过默认管道的方法,但我找不到它。我愿意接受建议和意见。

bitbucket-pipelines bitbucket-cloud

5
推荐指数
1
解决办法
1309
查看次数

使用 docker-compose 的 Bitbucket Pipeline:容器 ID 166535 无法映射到主机 ID

我正在尝试在 bitbucket 管道内使用 docker-compose 来构建多个微服务并对它们运行测试。但是我收到以下错误:

Step 19/19 : COPY . .
Service 'app' failed to build: failed to copy files: failed to copy directory: Error processing tar file(exit status 1): Container ID 166535 cannot be mapped to a host ID
Run Code Online (Sandbox Code Playgroud)

截至目前,我的docker-compose.yml如下所示:

version: '2.3'
services:
  app:
    build:
      context: .
      target: dev
    ports:
      - "3030:3030"
    image: myapp:dev
    entrypoint: "/docker-entrypoint-dev.sh"
    command: [ "npm", "run", "watch" ]
    volumes:
      - .:/app/
      - /app/node_modules
    environment:
      NODE_ENV: development
      PORT: 3030
      DATABASE_URL: postgres://postgres:@postgres/mydb
Run Code Online (Sandbox Code Playgroud)

我的 Dockerfile 如下: …

bitbucket node.js docker docker-compose bitbucket-pipelines

5
推荐指数
1
解决办法
9489
查看次数

如何从 Bitbucket Pipelines 保存构建日志

目前,我的管道设置方式是让每个步骤在“self.hosted”运行器上运行。我这样做是为了不必花费 Bitbucket 构建时间。每次管道运行时,我都可以看到容器在我的 Docker 应用程序上创建和终止。我发现的唯一调试方法是单击其中包含“构建”一词的容器。在容器内,我可以看到所有日志;每个项目构建步骤和测试。我正在尝试找到一种方法将这些构建日志保存到文本文件中并将其作为工件下载。Bitbucket 有生成支持日志的指南,但这些日志都不是构建日志。

bitbucket bitbucket-pipelines cicd

5
推荐指数
0
解决办法
1440
查看次数