Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hlx publish --only filtering does not filter, publishes all strains #895

Closed
filmaj opened this issue May 15, 2019 · 6 comments
Closed

hlx publish --only filtering does not filter, publishes all strains #895

filmaj opened this issue May 15, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@filmaj
Copy link
Contributor

filmaj commented May 15, 2019

Description
Running hlx publish --only *staging publishes all strains, even those that do not contain the word "staging".

To Reproduce

#!/bin/bash -eo pipefail
npm run publish:staging

> [email protected] publish:staging /home/circleci/project
> hlx publish --log-level=debug --only *staging

debug: ignoring proxy strain support-staging
debug: ignoring proxy strain staging
debug: ignoring proxy strain support-production
debug: ignoring proxy strain production
Publishing [] preparing fastly transaction 0.0sPublishing [] preparing service config for Helix 6.7sdebug: filtering
debug: this: default, launch-docs-staging, xd-docs-staging, starter-docs-staging, support-staging, static-staging, staging, launch-docs-production, xd-docs-production, starter-docs-production, support-production, static-production, production
debug: other: default, launch-docs-staging, xd-docs-staging, starter-docs-staging, support-staging, static-staging, staging, launch-docs-production, xd-docs-production, starter-docs-production, support-production, static-production, production
debug: default, launch-docs-staging, xd-docs-staging, starter-docs-staging, support-staging, static-staging, staging, launch-docs-production, xd-docs-production, starter-docs-production, support-production, static-production, production
Publishing [] set service config up for Helix 9.8sPublishing [] set up logging 1.6sPublishing [] enabled authentication 0.5sPublishing [] purged cache 0.0s

✅  The following strains have been published and version 132 is now online:
- launch-docs-staging: https://adobedevsite.helix-demo.xyz/launch/docs
- xd-docs-staging: https://adobedevsite.helix-demo.xyz/xd/docs
- starter-docs-staging: https://adobedevsite.helix-demo.xyz/starter/docs
- support-staging: https://adobedevsite.helix-demo.xyz/support
- static-staging: https://adobedevsite.helix-demo.xyz/static/
- staging: https://adobedevsite.helix-demo.xyz/
- launch-docs-production: https://developer.adobe.com/launch/docs
- xd-docs-production: https://developer.adobe.com/xd/docs
- starter-docs-production: https://developer.adobe.com/starter/docs
- support-production: https://developer.adobe.com/support
- static-production: https://developer.adobe.com/static/
- production: https://developer.adobe.com/

You may now access your site using:
$ curl https://adobedevsite.helix-demo.xyz/launch/docs

The full helix config for it is copied below. It is not revisioned as it is edited on-the-fly to insert the correct branch name for deploying pull request code. You can see that behaviour in the circleci steps "modify default repo to match current branch" and "hlx deploy dirty". Basically it replaces the branch name at the end of the &defaultRepo definition below from #master to #<PR-branch-name>.

version: 1
definitions:
  defaults:
    # Run default content from github repo
    - &defaultRepo https://github.com/adobe/developer.adobe.com.git#staging
  strains:
    base:
      &basestrain
      code: *defaultRepo
      content: *defaultRepo
      static: *defaultRepo
    proxy:
      &proxystrain
      origin: https://www.adobe.io/

strains:
  - name: default
    <<: *basestrain
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f

  # === STAGING URLS FOLLOW ===
  - name: launch-docs-staging
    <<: *basestrain
    url: https://adobedevsite.helix-demo.xyz/launch/docs
    # TODO: the following repo has no author or staging branch
    content: https://github.com/Adobe-Marketing-Cloud/reactor-user-docs.git#master
    directoryIndex: README.html
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: xd-docs-staging
    <<: *basestrain
    url: https://adobedevsite.helix-demo.xyz/xd/docs
    # TODO: the following repo has no author or staging branch
    content: https://github.com/AdobeXD/plugin-docs.git#master
    directoryIndex: README.html
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: starter-docs-staging
    <<: *basestrain
    url: https://adobedevsite.helix-demo.xyz/starter/docs
    content: https://github.com/AdobeDocs/starter-docs.git#author
    directoryIndex: Overview.html
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: support-staging
    origin: https://adobedocs.github.io/developer-support/
    url: https://adobedevsite.helix-demo.xyz/support
  - name: static-staging
    <<: *basestrain
    url: https://adobedevsite.helix-demo.xyz/static/
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: staging
    <<: *proxystrain
    url: https://adobedevsite.helix-demo.xyz/

  # === PRODUCTION URLS FOLLOW ===
  - name: launch-docs-production
    <<: *basestrain
    url: https://developer.adobe.com/launch/docs
    content: https://github.com/Adobe-Marketing-Cloud/reactor-user-docs.git#master
    directoryIndex: README.html
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: xd-docs-production
    <<: *basestrain
    url: https://developer.adobe.com/xd/docs
    content: https://github.com/AdobeXD/plugin-docs.git#master
    directoryIndex: README.html
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: starter-docs-production
    <<: *basestrain
    url: https://developer.adobe.com/starter/docs
    content: https://github.com/AdobeDocs/starter-docs.git#master
    directoryIndex: Overview.html
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: support-production
    origin: https://adobedocs.github.io/developer-support/
    url: https://developer.adobe.com/support
  - name: static-production
    <<: *basestrain
    url: https://developer.adobe.com/static/
    package: developer-adobe-com/6a63677df060f5f2f7571ce210f72bceadd3d36f
  - name: production
    <<: *proxystrain
    url: https://developer.adobe.com/

Expected behavior
hlx publish --only *staging would state that only the strains with names that end with staging were published.

Version:
2.5.4

@filmaj filmaj added the bug Something isn't working label May 15, 2019
@tripodsan
Copy link
Contributor

tripodsan commented May 16, 2019

AFAICS, this is correct. publish always needs to update and re-publish all the strains. the --only and --except filters select which strain configs are used from the current branch helix-config.yaml and which from master.

I think the debug output is not helpful, it should show something like:

debug: filtering strains:
debug: #mybranch: default, launch-docs-staging, xd-docs-staging, starter-docs-staging, support-staging, static-staging, staging, launch-docs-production, xd-docs-production, starter-docs-production, support-production, static-production, production
debug: #master: default, launch-docs-staging, xd-docs-staging, starter-docs-staging, support-staging, static-staging, staging, launch-docs-production, xd-docs-production, starter-docs-production, support-production, static-production, production
debug: strain selection:
from master (70dc130a0746e6f0ba413789fac67c5ca3b300b4):
 default, 
 launch-docs-production, 
 xd-docs-production, 
 starter-docs-production, 
 support-production, 
 static-production, 
 production
from mybranch (0eea0fc9f357bf29cc3a1624513873a61b9e8a4e):
 launch-docs-staging, 
 xd-docs-staging, 
 starter-docs-staging, 
 support-staging, 
 static-staging, 
 staging, 

The following strains have been published and version 132 is now online:
mybranch:
- launch-docs-staging: https://adobedevsite.helix-demo.xyz/launch/docs 
- xd-docs-staging: https://adobedevsite.helix-demo.xyz/xd/docs
- starter-docs-staging: https://adobedevsite.helix-demo.xyz/starter/docs
- support-staging: https://adobedevsite.helix-demo.xyz/support
- static-staging: https://adobedevsite.helix-demo.xyz/static/
- staging: https://adobedevsite.helix-demo.xyz/
master:
- launch-docs-production: https://developer.adobe.com/launch/docs
- xd-docs-production: https://developer.adobe.com/xd/docs
- starter-docs-production: https://developer.adobe.com/starter/docs
- support-production: https://developer.adobe.com/support
- static-production: https://developer.adobe.com/static/
- production: https://developer.adobe.com/

@trieloff
Copy link
Contributor

Yes, it's working as designed. The output that @tripodsan proposed would be a good enhancement.

@filmaj
Copy link
Contributor Author

filmaj commented May 16, 2019

OK... then the publish filtering does not help the devsite with handling separate environments. This is troublesome for us. We need this to have confidence in our deployments.

I guess I need to go back to the original purpose of this request: how do we push something ONLY to a staging environment that is publicly accessible and leverages fastly? That's what I thought the filtering was enabling: letting me deploy something to staging and running tests against staging BEFORE pushing to production. We need this as we have pushed bugs to production twice now. I imagine any client of helix will have a similar need...

@filmaj
Copy link
Contributor Author

filmaj commented May 16, 2019

To see how I wanted to use this feature, take a look at the changes to the circleci config in my staging-environment PR: https://github.com/adobe/developer.adobe.com/pull/173/files#diff-1d37e48f9ceff6d8030570cd36286a61

@filmaj
Copy link
Contributor Author

filmaj commented May 16, 2019

I think we have a solution in place, which will require a bunch of changes on the devsite. See this Slack conversation from #helix-chat for details.

Closing.

@filmaj filmaj closed this as completed May 16, 2019
@trieloff
Copy link
Contributor

See also #898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants