Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

publish removes strain conditions from untouched strains #672

Closed
tripodsan opened this issue Dec 7, 2020 · 3 comments
Closed

publish removes strain conditions from untouched strains #672

tripodsan opened this issue Dec 7, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@tripodsan
Copy link
Contributor

Description
assume a strain breaking-december with a package and a condition already published.
the strain.vcl will look like:

if (req.http.x-preflight-x-pages-version == "breaking-december") {
  set req.http.X-Sticky = "true";
  set req.http.X-Strain = "breaking-december";
} else {
  set req.http.X-Strain = "default";
}

In another branch with a config that only contains a strain breaking-january with a package and a condition.
after publish, the dictionay of the first strain breaking-december is untouched, since the strain is not listed in the config, but the strain.vcl now only contains the 2nd strain:

if (req.http.x-preflight-x-pages-version == "breaking-january") {
  set req.http.X-Sticky = "true";
  set req.http.X-Strain = "breaking-january";
} else {
  set req.http.X-Strain = "default";
}
@tripodsan tripodsan added the bug Something isn't working label Dec 7, 2020
@trieloff
Copy link
Contributor

trieloff commented Dec 7, 2020

I'd close this as WONTFIX, but with an explanation:

Helix Publish should be stateless and only represent the helix-config.yaml at the time of publishing. (This is why we are so reluctant to deploy dirty working copies).

The challenge is therefore how to get a helix-config.yaml that has all the strains you need:

Context:
adobe/helix-cli#895
adobe/helix-cli#898

@tripodsan
Copy link
Contributor Author

but there is a discrepancy between how the dictionaries are updated and the strains.vcl.
helix publish only updates the dicts of the strains in the config that have a package property.

The challenge is therefore how to get a helix-config.yaml that has all the strains you need:

the only way this could work more or less automatic is to have includes, like:

version: 1

definitions:
  defaults:
    # default repository. set to git remote repository before deployment
    - &defaultRepo https://github.com/tripodsan/helix-pages.git#master

preflight: https://adobeioruntime.net/api/v1/web/helix/helix-services/[email protected]

strains:
  - name: default
    code: *defaultRepo
    content: https://github.com/tripodsan/helix-pages.git#master
    static: https://github.com/tripodsan/helix-pages.git/htdocs#master
    package: tripod/3e0670464bc07f36395ed2eb812fe20e4629f54d

!include https://github.com/adobe/helix-pages#breaking-december/helix-config-strain.yaml
!include https://github.com/adobe/helix-pages#breaking-january/helix-config-strain.yaml

(we would need to build the !include handler).

so how this would work:

  1. starting with a main that only has the default strain.
  2. create a breaking-december branch. add a strain to a helix-config-strain.yaml
  3. add the include directive to the helix-config.yaml
  4. commit the altered helix-config.yaml and strain fragment to the breaking-december branch
  5. merge the commit back to main, but keep the branch
  6. start adding the breaking-december specific changes to the branch; update the version-lock in the helix-config-strain.yaml
  7. hlx deploy in the breaking-december branch needs to understand the include and update it accordingly.
  8. hlx publish in the breaking-december branch works, since it has the latest helix-config.yaml from main and all it's includes
  9. hlx publish in the main branch works, since it has all the includes.

@trieloff
Copy link
Contributor

trieloff commented Dec 8, 2020

As discussed, let's try --only $CI_BRANCH

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

No branches or pull requests

2 participants