使用 rsync 运行 bitbucket 管道时将特定文件保留在服务器上

使用 rsync 运行 bitbucket 管道时将特定文件保留在服务器上

我有一个 bitbucket 管道设置,用于 rsync 到托管 Wordpress 站点的服务器。服务器上的文件最初有一个包含 wp-config.php 和 wp-config-sample.php 的 WordPress 网站框架,但所有其他 wp 文件都将被发送过来。

当我运行管道时,如何确保管道运行后 wp-config 和 wp-config-sample 保留在服务器上(我在 gitignore 中有 wp-config.php,所以它永远不会发送过来)

管道代码在这里:

# pipelines deployment configuration
# -----
# Staging deployment happens with every push of the development branch.
#
# To run the Production deployment, access the repository > latest commit page,
# click on "Run Pipeline" and select "Custom: Production" from the dropdown.
# -----
# DO NOT change any of the variables below. To set them go to: PROJECT > Settings > Pipelines > Repository Variables
# Make sure the development branch is correctly named below - "develop" is being used below

image: node:10.15.3

pipelines:
  branches:
    develop: #name of the development branch
      - step:
          script:
            - pipe: atlassian/rsync-deploy:0.3.1
              variables:
                USER: $STAGING_USER
                SERVER: ''
                REMOTE_PATH: $STAGING_PATH
                LOCAL_PATH: './'
                EXTRA_ARGS: '-p --exclude-from=exclude-pipelines.txt'
            - ssh $STAGING_USER@ "find $STAGING_FOLDER. -type d -print0 | xargs -0 chmod 0755"
            - ssh $STAGING_USER@ "find $STAGING_FOLDER. -type f -print0 | xargs -0 chmod 0644"
    main: #name of the development branch
      - step:
          script:
            - pipe: atlassian/rsync-deploy:0.3.1
              variables:
                USER: $PRODUCTION_USER
                SERVER: ''
                REMOTE_PATH: $PRODUCTION_PATH
                LOCAL_PATH: './'
                EXTRA_ARGS: '-p --exclude-from=exclude-pipelines.txt'
            - ssh $PRODUCTION_USER@ "find public_html/. -type d -print0 | xargs -0 chmod 0755"
            - ssh $PRODUCTION_USER@ "find public_html/. -type f -print0 | xargs -0 chmod 0644"
  custom:
    Production:
      - step:
          script:
            - pipe: atlassian/rsync-deploy:0.3.1
              variables:
                USER: $PRODUCTION_USER
                SERVER: ''
                REMOTE_PATH: $PRODUCTION_PATH
                LOCAL_PATH: './'
                EXTRA_ARGS: '-p --exclude-from=exclude-pipelines.txt'
            - ssh $PRODUCTION_USER@ "find public_html/. -type d -print0 | xargs -0 chmod 0755"
            - ssh $PRODUCTION_USER@ "find public_html/. -type f -print0 | xargs -0 chmod 0644"

相关内容