Bitbucket Pipeline - 如何排除文件或文件夹?

Bitbucket Pipeline - how to exclude files or folders?

如何排除文件夹或文件上传到服务器?

我想忽略 "src" 文件夹和 package.json。

# -----
image: node:10.15.3

pipelines:
  branches:
    develop:
    - step:
        caches:
        - node
        name: Deploy to develop (Nino) Continuous integration.
        script: # Modify the commands below to build your repository.
          - echo 'Deploying.. hold your horses!'
          - yarn install
          - yarn dev
          - pipe: atlassian/sftp-deploy:0.4.1
            variables:
                USER: $USER
                PASSWORD: $ROOT_PASSWORD
                SERVER: $SERVER
                REMOTE_PATH: /var/www/html/wordpress-starter/
                DEBUG: 'false'

你可以试试这个

EXTRA_ARGS: '--exclude=YOUR_DESIRE_FOLDER_PATH/*'

有关详细信息,请查看 this

如果您不想排除多个文件或目录,您应该考虑使用 rsync-deploy 管道:

script:
  - pipe: atlassian/rsync-deploy:0.3.2
    variables:
      USER: 'ec2-user'
      SERVER: '127.0.0.1'
      REMOTE_PATH: '/var/www/build/'
      LOCAL_PATH: 'build'
      DEBUG: 'true'
      EXTRA_ARGS: '--exclude=src/* --exclude=package.json'

您可以反其道而行之,指定要在每个步骤中作为触发器包含的文件夹:

- step:
          name: ...
          image: ...
          script:
              - ...
          condition:
              changesets:
                 includePaths:
                   - "folder1/*"
                   - "folder2/*"

在此示例中,该步骤仅在 folder1 或 folder2 更改时 运行。 在这里找到它:https://dev.to/omar16100/trigger-bitbucket-pipeline-only-if-certain-files-are-changed-with-google-cloud-functions-1abc