简体   繁体   English

BitBucket管道 - 使用node / gulp / git ftp构建和部署

[英]BitBucket Pipeline - Build and deploy using node / gulp / git ftp

I noticed yesterday that BitBucket supported CICD pipelines, which is an amazing feature I'm eager to use. 昨天我注意到BitBucket支持CICD管道,这是我渴望使用的一个了不起的功能。

I have however some difficulty setting it up. 但是我设置起来有些困难。

My building process in general: 我的建设过程一般:

  • npm install npm安装
  • npm install -g bower npm install -g bower
  • bower install 凉亭安装
  • npm install -g gulp npm install -g gulp
  • gulp

The gulp command is building the HTML application and places the output to a build folder. gulp命令正在构建HTML应用程序并将输出放置到build文件夹。 After the build has been completed, I'd like the code to be transfered to a directory on my website. 构建完成后,我希望将代码转移到我网站上的目录中。

This translates to the following bitbucket.yml : 这转换为以下bitbucket.yml

# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.4

pipelines:
  default:
    - step:
        caches:
          - node
        script: # Modify the commands below to build your repository.
          - npm install
          - npm install -g bower
          - bower install --allow-root
          - npm install -g gulp
          - gulp
          - cd build
          - apt-get update
          - apt-get -qq install git-ftp
          - git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://mywebsite.com/public_html/mydirectory

The issue I'm getting is that the git ftp init seems to be uploading the src folder, and not the contents of the build one which is created during the gulp step. 我得到的问题是git ftp init似乎是上传src文件夹,而不是在gulp步骤中创建的build内容。

Any ideas? 有任何想法吗?


Update: --syncroot does seem to be a partial fix. 更新:-- --syncroot似乎是一个部分修复。 Meaning it does try to upload the build directory now. 这意味着它现在尝试上传build目录。 However, the problem at this point is that git ftp only seems to be syncing tracked files. 但是,此时的问题是git ftp似乎只是同步跟踪文件。

Because the files in the build folder are created during the pipeline build, that does not apply to those. 因为build文件夹中的文件是在管道构建期间创建的,所以不适用于这些文件。

I have tried to add a file named .git-ftp-include , which as described should transfer untracked files. 我试图添加一个名为.git-ftp-include的文件, .git-ftp-include应该传输未跟踪的文件。 Sadly, I haven't been successful in deploying my code. 遗憾的是,我没有成功部署我的代码。

.git-ftp-include file contents: build/index.html:/src/index.html .git-ftp-include文件内容:build / index.html:/src/index.html

Which basically says: upload index.html from the build syncroot whenever the index.html in the src directory is changed. 基本上说:每当src目录中的index.html发生更改时,都会从build同步根中上传index.html

对于要通过git-ftp传输的未跟踪文件, .git-ftp-include的语法是!filename

In this case I recommend that you use ncftp . 在这种情况下,我建议您使用ncftp In the Pipelines will be something like: 在管道中将是这样的:

- apt-get -qq install ncftp
- ncftpput -v -u "$FTP_USERNAME" -p "$FTP_PASSWORD" -R $FTP_HOST /remote build/*

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

相关问题 需要使用 bitbucket-pipeline 将 Node.js docker 镜像部署到 AWS Elastic Beanstalk - Need to deploy Node.js docker image to AWS Elastic Beanstalk using bitbucket-pipeline 使用Bitbucket Pipeline和AWS CodeDeploy自动部署Angular 4 App - Auto Deploy Angular 4 App using Bitbucket Pipeline and AWS CodeDeploy 使用Node和Gulp设置构建服务器 - Setting up build server using Node and Gulp 仅使用gulp或webpack构建此节点项目 - Build this node project using only gulp or webpack 用于 GAE 的 React App + Node Gitlab cicd 管道(构建和部署) - React App + Node Gitlab cicd pipeline for GAE (Build and Deploy) Firebase 部署在控制台中有效,但在 bitbucket 管道中无效 - Firebase deploy works in the console but not in bitbucket pipeline BitBucket管道:在Microsoft / dotnet:sdk映像上为Gulp添加NodeJS - BitBucket Pipeline: Adding NodeJS for Gulp on the microsoft/dotnet:sdk image Bitbucket 管道:容器“构建”超出 memory 限制 - Bitbucket Pipeline: Container 'Build' exceeded memory limit 如何使用GULP / NODE在JavaScript中获取Jenkins BUILD_NUMBER? - How to get Jenkins BUILD_NUMBER in JavaScript using GULP/NODE? previos任务完成后,如何部署gulp-ftp? - How to deploy gulp-ftp, after previos task?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM