delongmanor/jd-quicksilvers

我希望能够工作的Quicksilver。

安装: 398

依赖: 0

建议者: 0

安全: 0

类型:quicksilver-script

1.0.12 2022-01-04 07:30 UTC

This package is auto-updated.

Last update: 2024-09-04 13:07:28 UTC


README

请注意,所有这些都使用secrets.json,所以如果你使用多个,只推送一次是有意义的。

Quicksilver Pushback - 不工作

此Quicksilver项目与基于Terminus Build Tools的各个示例仓库结合使用,将Pantheon仪表板上的任何提交推回站点的原始Git仓库。这使得开发人员(或其他用户)可以在SFTP模式下在Pantheon仪表板上工作并提交代码,通过Pantheon将代码提交回规范的上游仓库,通过PR实现。这在需要导出配置(Drupal、WP-CFM)的场景中特别有用。

该项目维护在其自己的仓库中,位于https://github.com/pantheon-systems/quicksilver-pushback。请查看该页面以获取有关项目的更多信息,包括安装说明。请注意,如果您使用Terminus Build Tools插件,则它将自动安装,所以除非您遵循非标准工作流程,否则您可能不需要自己安装。

Asana集成 - 不工作

此功能解析提交消息中的Asana任务ID,并在相关Asana任务中添加提交消息作为注释。

示例评论

[389749465118801]: 调整布局间距

包含多个Asana任务的提交将在每个提到的问题上发布评论。每次将提交推送到任何开发或multidev分支时,都会添加注释;每个Asana注释都会标注相应的提交哈希和触发提交的Pantheon环境。

说明

  • 在Asana中,转到我的个人资料设置 -> 应用程序 -> 管理开发者应用程序 -> 创建新个人访问令牌,并复制新令牌。
  • 将Asana个人访问令牌存储在名为secrets.json的文件中,并将其存储在站点的私有文件区域。
  $> echo '{"asana_access_token" : "Your generated Personal Access Token" }' > secrets.json
  # Note, you'll need to copy the secrets into each environment where you want to save commit messages to Asana
  $> `terminus site connection-info --env=dev --site=your-site --field=sftp_command`
      Connected to appserver.dev.d1ef01f8-364c-4b91-a8e4-f2a46f14237e.drush.in.
  sftp> cd files
  sftp> mkdir private
  sftp> cd private
  sftp> put secrets.json

  • 将示例asana_integration.php脚本添加到代码仓库的private目录。
  • 将Quicksilver操作添加到您的pantheon.yml中,以便在部署后执行脚本。
  • 推送包含Asana任务ID的提交代码!

注意:如果您在Asana中打开任务,URL将类似于以下内容:https://app.asana.com/0/389749465118800/389749465118801 第二个数字是您的任务ID。在提交中将其括在[]中。

可选地,您可能希望使用terminus workflow:watch命令以获得即时的调试反馈。

示例pantheon.yml

以下是一个示例,说明如果这是您想要使用的唯一Quicksilver操作,您的pantheon.yml将看起来像什么

api_version: 1

workflows:
  sync_code:
    after:
      - type: webphp
        description: Asana Integration
        script: private/scripts/quicksilver/jd-quicksilvers/asana_integration.php

Quicksilver调试

此示例旨在为希望使用快速调试示例探索Quicksilver潜力的用户。

设置此示例很简单

  1. 将示例debug.php脚本添加到代码仓库的private目录。
  2. 将Quicksilver操作添加到您的pantheon.yml中,以便在缓存清除后执行脚本。
  3. 启动terminus以监视工作流程日志。
  4. 将所有内容推送到Pantheon。
  5. 清除缓存并查看输出!

示例pantheon.yml

以下是一个示例,说明如果这是您想要使用的唯一Quicksilver操作,您的pantheon.yml将看起来像什么

api_version: 1

workflows:
  clear_cache:
    after:
      - type: webphp
        description: Dump debugging output
        script: private/scripts/quicksilver/jd-quicksilvers/debug.php

示例terminus workflow:watch输出

从仪表板触发缓存清除时,您应该会看到以下类似的良好调试输出

$> terminus workflow:watch your-site-name
[2015-12-15 03:17:26] [info] Watching workflows...
[2015-12-15 03:17:50] [info] Started 1c5421b8-a2db-11e5-8a28-bc764e10b0ce Clear cache for "dev" (dev)
[2015-12-15 03:17:58] [info] Finished Workflow 1c5421b8-a2db-11e5-8a28-bc764e10b0ce Clear cache for "dev" (dev)
[2015-12-15 03:18:00] [info]
------ Operation: Dump debugging output finished in 2s ------
Quicksilver Debuging Output


========= START PAYLOAD ===========
Array
(
    [wf_type] => clear_cache
    [user_id] => ed828d9d-2389-4e8d-9f71-bd2fcafc93c2
    [site_id] => 6c5ee454-9427-4cce-8193-a44d6c54172c
    [user_role] => owner
    [trace_id] => 1c4b90c0-a2db-11e5-9ca4-efb1318547fc
    [environment] => dev
    [wf_description] => Clear cache for "dev"
    [user_email] => josh@getpantheon.com
)

========== END PAYLOAD ============

《wf_type》、《wf_description》和user_email的值可能特别引起关注。您可以从$_SERVER$_ENV超级全局变量中获取更多信息。您还可以查询git仓库的状态,以及启动CMS。有很多可能性!祝您使用Quicksilver愉快!

通过Diffy.website进行视觉回归测试

本示例将向您展示如何将Diffy.website的视觉回归操作集成到您的部署工作流程中。

这将使您在每次部署到测试环境时,都能在实时环境和测试环境之间进行视觉比较。

对于更高级的用例,包括对Multidev实例进行视觉回归,此脚本可以轻松地适应Diffy.website的REST API:https://diffy.website/rest

说明

视频演示可在https://youtu.be/U8uHJELeTDE查看。

为了启动,您首先需要设置一个Diffy.website项目

  1. 要么登录您的账户,要么在https://diffy.website注册一个新账户。
  2. 为您的网站设置一个Diffy项目,并在项目设置中定义生产环境和预发布URL。

然后,您需要将相关代码添加到您的Pantheon项目中

  1. 将示例diffyVisualregression.php脚本添加到代码存储库中的'private/scripts/quicksilver/jd-quicksilvers/'目录。
  2. 在Diffy中创建一个API令牌。复制令牌和project_id到名为secrets.json的文件中,并将其存储在private files目录。

        $> echo '{"token": "yourToken", "project_id" : "123"}' > secrets.json
        sftp YOURCREDENTIALS_TO_LIVE_ENVIRONMENT
        sftp> cd files
        sftp> mkdir private
        sftp> cd private
        sftp> put secrets.json
        sftp> quit
        ```
    
    
  3. 在您的pantheon.yml中添加一个Quicksilver操作,在部署到测试后执行脚本。

    api_version: 1
    

workflows: deploy

after:
  - type: webphp
    description: Do a visual regression test with Diffy.website
    script: private/scripts/quicksilver/jd-quicksilvers/diffyVisualregression.php
4. Make a deploy to test environment!

Optionally, you may want to use the `terminus workflows watch YOUR_SITE_ID` command to get immediate debugging feedback. First you would need to install and authenticate your terminus.

# New Relic Deploy Logs #

This example will show you how you can automatically log changes to your site into [New Relic's Deployments Page](https://docs.newrelic.com/docs/apm/applications-menu/events/deployments-page) when the workflow fires on Pantheon. This can be quite useful for keeping track of all your performance improvements!

This script uses a couple clever tricks to get data about the platform. First of all it uses the `pantheon_curl()` command to fetch the extended metadata information for the site/environment, which includes the New Relic API key. It also uses data within the git repository on the platform to pull out deploy tag numbers and log messages. 

> **Note:** This example will work for all Pantheon sites once the bundled [New Relic APM Pro feature](https://pantheon.io/features/new-relic) is activated, regardless of service level. 

## Instructions ##

Setting up this example is easy:

1. [Activate New Relic Pro](https://pantheon.io/docs/new-relic/#activate-new-relic-pro) within your site Dashboard. 
2. Add the example `new_relic_deploy.php` script to the `private` directory of your code repository.
3. Add a Quicksilver operation to your `pantheon.yml` to fire the script after a deploy.
4. Test a deploy out!

Optionally, you may want to use the `terminus workflow:watch yoursitename` command to get immediate debugging feedback.

### Example `pantheon.yml` ###

Here's an example of what your `pantheon.yml` would look like if this were the only Quicksilver operation you wanted to use:

始终需要指定pantheon.yml API版本。

api_version: 1

您可能还需要以下内容

php_version: 7.0

drush_version: 8

workflows: # 在部署到测试或实时时记录到New Relic。 deploy

after:
  - type: webphp
    description: Log to New Relic
    script: private/scripts/quicksilver/jd-quicksilvers/new_relic_deploy.php

# 还记录sync_code,以便您可以跟踪新代码进入dev/multidev。 sync_code

after:
  - type: webphp
    description: Log to New Relic
    script: private/scripts/quicksilver/jd-quicksilvers/new_relic_deploy.php

# Slack Integration #

This script shows how easy it is to integrate Slack notifications from your Pantheon project using Quicksilver. As a bonus, we also show you how to manage API keys outside of your site repository.

## Instructions ##

1. [Enable Incoming Webhooks](https://my.slack.com/services/new/incoming-webhook/) for your Slack instance.
2. Copy the secret Webhook URL into a file called `secrets.json` and store it in the [private files](https://pantheon.io/docs/articles/sites/private-files/) directory of every environment where you want to trigger Slack notifications.

$> echo '{"slack_url": "https://hooks.slack.com/services/MY/SECRET/URL"}' > secrets.json
# Note, you'll need to copy the secrets into each environment where you want to trigger Slack notifications.
$> `terminus connection:info  --field=sftp_command site.env`
    Connected to appserver.dev.d1ef01f8-364c-4b91-a8e4-f2a46f14237e.drush.in.
sftp> cd files  
sftp> mkdir private
sftp> cd private
sftp> put secrets.json
sftp> quit

3. Add, and update as needed, the example `slack_notification.php` script to the `private` directory in the root of your site's codebase, that is under version control. Note this is a different `private` directory than where the secrets.json is stored.
4. Add Quicksilver operations to your `pantheon.yml`
5. Test a deploy out!

Optionally, you may want to use the `terminus workflows watch` command to get immediate debugging feedback. You may also want to customize your notifications further. The [Slack API](https://api.slack.com/incoming-webhooks) documentation has more on your options.

### Example `pantheon.yml` ###

Here's an example of what your `pantheon.yml` would look like if this were the only Quicksilver operation you wanted to use.  Pick and choose the exact workflows that you would like to see notifications for.

api_version: 1

workflows: deploy_product

after:
    - type: webphp
      description: Post to Slack after site creation
      script: private/scripts/quicksilver/jd-quicksilvers/slack_notification.php

create_cloud_development_environment

after: 
    - type: webphp
      description: Post to Slack after Multidev creation
      script: private/scripts/quicksilver/jd-quicksilvers/slack_notification.php

deploy

after:
    - type: webphp
      description: Post to Slack after deploy
      script: private/scripts/quicksilver/jd-quicksilvers/slack_notification.php

sync_code

after:
    - type: webphp
      description: Post to Slack after code commit
      script: private/scripts/quicksilver/jd-quicksilvers/slack_notification.php

clear_cache

after:
    - type: webphp
      description: Someone is clearing the cache again
      script: private/scripts/quicksilver/jd-quicksilvers/slack_notification.php

# Trello Integration #

This example parses commit messages for Trello card IDs and adds the commit message as a comment in the related Trello card.

Example comments:

  [s3yxNR5v]: Adjust layout spacing

Commits that contain multiple Trello cards will post comments to each issue mentioned. A comment will be added each time a commit is pushed to any dev or multidev branch; each Trello comment is labeled with the appropriate commit hash and Pantheon environment that triggered the post.

## Instructions ##

- Go to https://trello.com/app-key and copy your app key. Also click the link to generate a token for yourself, approve access and copy the token.
- Copy your Trello credentials (key + token) into a file called `secrets.json` and store it in the private files area of your site

$> echo '{"trello_key" : "您的应用程序密钥" , "trello_token" : "您生成的令牌" }' > secrets.json # 注意,您需要将密钥复制到您希望保存提交消息到Trello的每个环境中 $> terminus site connection-info --env=dev --site=your-site --field=sftp_command

  Connected to appserver.dev.d1ef01f8-364c-4b91-a8e4-f2a46f14237e.drush.in.

sftp> cd files sftp> mkdir private sftp> cd private sftp> put secrets.json

- Add the example `trello_integration.php` script to the `private` directory of your code repository.
- Add a Quicksilver operation to your `pantheon.yml` to fire the script after a deploy.
- Push code with a commit message containing a Trello card ID!

Optionally, you may want to use the `terminus workflow:watch` command to get immediate debugging feedback.

### Example `pantheon.yml` ###

Here's an example of what your `pantheon.yml` would look like if this were the only Quicksilver operation you wanted to use:

api_version: 1

workflows: sync_code

after:
  - type: webphp
    description: Trello Integration
    script: private/scripts/quicksilver/jd-quicksilvers/trello_integration.php