标签: bitbucket-pipelines

使用Bitbucket Pipelines和Docker为Ruby on Rails项目设置CD

我喜欢在Bitbucket Pipelines中为Ruby on Rails/PostgreSQL/Sidekiq项目设置持续部署,但是我很难理解它是如何组合在一起的,特别是如何在Docker镜像中使用postgres .我是Docker和Pipelines的新手.

在我的谷歌搜索中,Docker谈到使用docker-compose创建一个包,所以我有一个Postgres容器和一个Sideqik容器,然后将它们与app容器链接.但我不确定捆绑包和图像之间的区别是什么,以及Bitbucket Pipelines是否支持捆绑包.最终我想在Heroku上设置部署到临时环境,但是现在只rspec spec需要在Pipelines中工作就可以了.

是否存在已经设置了Ruby + PostgreSQL的现有公共映像,我可以使用它?如果没有,我从哪里开始?我当前的Dockerfile如下所示:

FROM postgres:9.4
FROM ruby:2.3.1-onbuild
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client
Run Code Online (Sandbox Code Playgroud)

然后我运行docker build .docker run -it my-image /bin/bash执行以下命令:

root@a84ad0e7c16b:/usr/src/app# postgres
bash: postgres: command not found
root@a84ad0e7c16b:/usr/src/app# psql 
psql: could not connect to server: No such file or directory
  Is the server running locally and accepting
  connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails docker docker-compose bitbucket-pipelines

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

使用Bitbucket Pipeline将整个Bitbucket repo上传到S3

我正在使用Bitbuckets Pipeline.我希望它将我的仓库(非常小)的全部内容推送到S3.我不想将其压缩,推送到S3然后解压缩.我只是希望它在我的Bitbucket仓库中采用现有的文件/文件夹结构并将其推送到S3.

yaml文件和.py文件应该是什么样的?

这是当前的yaml文件:

image: python:3.5.1

pipelines:
  branches:
    master:
      - step:
          script:
            # - apt-get update # required to install zip
            # - apt-get install -y zip # required if you want to zip repository objects
            - pip install boto3==1.3.0 # required for s3_upload.py
            # the first argument is the name of the existing S3 bucket to upload the artefact to
            # the second argument is the artefact to be uploaded
            # the third argument is the the bucket key …
Run Code Online (Sandbox Code Playgroud)

bitbucket amazon-s3 bitbucket-pipelines

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

Bitbucket Pipeline如何设置ssh代理以在远程服务器上部署

这是我想要实现的工作流程:

  1. 提交代码
  2. bitbucket管道在我的公共docker镜像上运行测试
  3. bitbucket管道执行ansible脚本以部署在我的公共docker镜像上

前两个步骤工作正常,但问题是:如何/我应该在哪里存储我的私钥以允许ansible通过ssh代理ssh到我的远程服务器?

我有点不愿意将私钥存储在Pipeline环境设置中,因为其他人都拥有对repo的管理员权限可以看到它.

这里有一个类似的问题,但答案建议在docker上设置密钥并使用私人仓库,这与我的有点不同.

docker bitbucket-pipelines

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

Bitbucket管道 - 将一个分支合并到另一个分支的可能性

我有一个包含两个分支的存储库:masterDev,我想以这样的方式配置pipline,当我将代码推送到Dev分支并且代码构建成功时,Dev被合并到master.不幸的是,我无法在bitbucket piplines docs中找到有关合并的任何信息.

那是我的yml文件:

pipelines:
  branches:
    Dev:
      - step:
          script:
            - ant deployCodeCheckOnly -Dsf.username=$SF_USERNAME -Dsf.password=$SF_PASSWORD
Run Code Online (Sandbox Code Playgroud)

那个案子可以帮助我吗?如果有可能吗?

- 编辑

我尝试将脚本更改为sugest:

pipelines:
  branches:
    Dev:
      - step:
          script:
            - ant deployCodeCheckOnly -Dsf.username=$SF_USERNAME -Dsf.password=$SF_PASSWORD
            - git remote -v
            - git fetch
            - git checkout master
            - git merge Dev
            - git push -v --tags origin master:master
Run Code Online (Sandbox Code Playgroud)

结果:

git remote -v
+ git remote -v
origin  git@bitbucket.org:repository/project.git (fetch)
origin  git@bitbucket.org:repository/project.git (push)

git fetch origin …
Run Code Online (Sandbox Code Playgroud)

bitbucket bitbucket-pipelines

6
推荐指数
2
解决办法
3024
查看次数

如何从bitbucket-pipelines.yml进行git push?

我有一个节点项目。我想要做的是在开发人员签入(提交和推送)上,我想运行将在内部执行以下操作的bitbucket管道

  1. npm安装和npm测试
  2. npm版本补丁(增加package.json中的版本)
  3. git push origin master-关注标签
  4. npm发布

bitbucket-pipelines.yml

    image: node:8
    pipelines:
      default:
        - step:
            caches:
              - node
            script:
              - npm version patch
              - git push origin develop --follow-tags
              - npm publish
Run Code Online (Sandbox Code Playgroud)

我在“ git push origin master --follow-tags”上遇到问题。如何授予管道推送回存储库的权限?

我也想知道这是否会触发一个循环,因为我增加了package.json版本并进行了检入(提交和推送),所以我的位桶管道再次执行?

在使用bitbucket-pipelines的nodejs项目上,使用版本号递增的CI / CD的推荐方式是什么?

干杯,罗希特

git continuous-integration node.js package.json bitbucket-pipelines

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

如何在Bitbucket-Pipelines中保存工件

我是竹子新手.我尝试做的是收集.dacpac在构建过程中创建的所有文件.

image: microsoft/dotnet:latest
pipelines:
 default: 
 - step: 
 script: # Modify the commands below to build your repository. 
 - cd BackgroundCode 
 - dotnet restore 
 - dotnet run 
 artifacts: 
 - '../**/*.dacpac'
Run Code Online (Sandbox Code Playgroud)

目录结构将是

'剂/建造/项目/ [项目]/[项目] .dacpac'.

管道的输出说

成功生成zip存档/opt/atlassian/pipelines/agent/build/Projects/[ProjectName]/[ProjectName].dacpac

这意味着在构建过程中确实生成了文件.我做错了什么吗?如果不是,我会在哪里找到这些文物.

bamboo bitbucket-pipelines

6
推荐指数
2
解决办法
4786
查看次数

Bitbucket Pipelines 可以与 Windows docker 文件一起运行吗?

正如标题所问,bitbucket 管道可以与 Windows docker 一起运行吗?

一些背景 - 我一直在对竹子上的管道进行一些研究。我遇到的许多文章都是在 Pipelines 仍处于测试阶段且仅支持 Linux docker 文件时出现的。我似乎找不到任何有关管道是否适用于 Windows 的信息。

奖金问题!对于大型网站,您对使用 bitbucket 管道而不是竹子部署有何看法?

docker bitbucket-pipelines

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

无法从 bitbucket 管道 yml 脚本检出 git 分支

我希望在部署到 QA 服务器之前在 staging 之上进行 rebase(或与 staging 合并),这样它将包含来自我的分支的最新更改和更改。

作为第一步,我尝试检查暂存并失败:我在 bitbucket-pipelines.yml 中有以下配置

merge:
- step:
    name: merge with staging
    image: node:8
    script:
    - git remote update
    - git fetch origin
    - git branch -f staging origin/staging
    - git checkout staging
Run Code Online (Sandbox Code Playgroud)

错误:

+ git branch -f staging origin/staging
fatal: Not a valid object name: 'origin/staging'.
Run Code Online (Sandbox Code Playgroud)

我确实尝试了很多在本地工作的其他变体,但一切都失败了...看起来 bitbucket 限制了对其他分支的访问..

检查 bitbucket 管道中的分支的正确方法是什么?

git bitbucket bitbucket-pipelines

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

W:无法获取http://httpredir.debian.org/debian/dists/jessie-updates/main/binary-amd64/Package 404未找到

我的Bitbucket管道的[相关部分]如下所示:

  - step:
      image: python:3.5.1
      name: upload to s3
      script:
        - export S3_BUCKET="elasticbeanstalk-us-east-1-122232355432"
        - export VERSION_LABEL=$(cat VERSION_LABEL)
        - apt-get update # required to install zip
        - apt-get install -y zip # required for packaging up the application
        - pip install boto3==1.3.0 # required for upload_to_s3.py
        - zip --exclude=*.git* -r /tmp/artifact.zip . # package up the application for deployment
        - python upload_to_s3.py # run the deployment script
Run Code Online (Sandbox Code Playgroud)

但是,当我在Bitbucket中运行它时,出现以下错误

+ apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://httpredir.debian.org …
Run Code Online (Sandbox Code Playgroud)

debian bitbucket apt-get bitbucket-pipelines debian-jessie

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

bitbucket 管道化变量

可以在管道文件内声明变量,如以下 GitHub 示例所示:

# ...

env:
  NODE_VERSION: 16.3.1
  FOLDER_PATH: Project


# ...

    steps:
      - name: Move to project folder
        run: cd $FOLDER_PATH

# ...
Run Code Online (Sandbox Code Playgroud)

是否可以在 bitbucket 管道文件中执行类似的操作?(如何?)

谢谢任何帮助:)

bitbucket bitbucket-pipelines

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