rsyncを使用してbitbucketパイプラインを実行すると、サーバーに特定のファイルを保持します。

rsyncを使用してbitbucketパイプラインを実行すると、サーバーに特定のファイルを保持します。

WordPressサイトをホストしているサーバーのrsync用のビットバケットパイプライン設定があります。サーバー上のファイルには、最初にwp-config.phpとwp-config-sample.phpを含むWordPress Webサイトのスケルトンがありますが、他のすべての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"

ベストアンサー1

おすすめ記事