Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

add legal-docs as a dependency w/ symlinks; fixes #738 #2357

Merged
merged 1 commit into from
Apr 10, 2017

Conversation

clouserw
Copy link
Member

@pdehaan mentioned that the legal-docs repository has a package.json file in it so we can include it as a dependency. This would make the patch super easy and is what I've done below.

r? @fzzzy for the overall patch. One thing I noticed is that the old file was named de.md and the one in the legal-docs repo is de-DE.md. I remember the bugs where de-DE content wouldn't show up for de, and we might be hitting that again here. I'll check with legal.

r? @eleemoz In case you're reading github-mail: The German Test Pilot legal docs (terms and privacy policies) are specifying they are German for Germany (de-DE) instead of just German (de). Is that on purpose? If not, I'd like to change it.

r? @relud because I want to make sure symlinks will work like this when we deploy. Any concerns with this? Also, does our environment get recreated with each deploy so it would re-download these fresh or do we have to think about stale content here?

@clouserw clouserw requested review from fzzzy and relud March 28, 2017 20:24
@ghost ghost added the status:inreview label Mar 28, 2017
@codecov-io
Copy link

codecov-io commented Mar 28, 2017

Codecov Report

Merging #2357 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2357   +/-   ##
======================================
  Coverage    95.5%   95.5%           
======================================
  Files         106     106           
  Lines        2445    2445           
======================================
  Hits         2335    2335           
  Misses        110     110

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7e1a4a...17e892e. Read the comment docs.

Copy link
Contributor

@fzzzy fzzzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The technical details here look correct to me.

As for the deployment question, I believe the build process will see the symlinked md files and thus kick off the correct builds, but then the output is just html files in the build directory, so nothing should change in terms of deployment.

@relud
Copy link

relud commented Mar 28, 2017

I want to make sure symlinks will work like this when we deploy. Any concerns with this?

I just tested, and symlinks work with awscli. I can't say for certain because these files are copied by the build process, but stage will tell all.

Also, does our environment get recreated with each deploy so it would re-download these fresh or do we have to think about stale content here?

our deployment does not git clean between deploys, and also it uses the following Dockerfile to build, which may cache after npm install when package.json doesn't change if I understand docker correctly:

FROM node:6.2.0
WORKDIR /app
COPY package.json /app/package.json
RUN npm install
COPY addon/package.json /app/addon/package.json
RUN cd addon && npm install
COPY . /app
CMD cd addon && npm run sign && cd .. && NODE_ENV=production ENABLE_PONTOON=0 npm run static

I could reconfigure deploys to build everything from scratch if that is desired though.

@@ -32,7 +32,8 @@
"redux-logger": "^2.8.2",
"redux-promise": "^0.5.3",
"reselect": "^2.5.4",
"seedrandom": "^2.4.2"
"seedrandom": "^2.4.2",
"tos-pp": "https://github.com/mozilla/legal-docs.git"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this appears to cause the follow problem during npm run static in builds:

Error: Cannot find module 'tos-pp' from '/home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest'
    at /home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest/node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
    at process (/home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest/node_modules/browser-resolve/node_modules/resolve/lib/async.js:173:43)
    at ondir (/home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest/node_modules/browser-resolve/node_modules/resolve/lib/async.js:188:17)
    at load (/home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /home/jenkins/slave/workspace/pipelines/testpilot/addons/reludtest/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:117:15)

@relud
Copy link

relud commented Mar 28, 2017

update: I just filed mozilla-services/cloudops-deployment#561 which changes the process used to build the static website and addons to be more idiomatic to jenkins. It removes the Dockerfile I mentioned two comments ago, and adds a git clean -fxd to deploys. This change would prevent issues with stale legal docs.

@lmorchard
Copy link
Contributor

lmorchard commented Mar 29, 2017

FWIW, I think we've tried to avoid symlinks in the repo (e.g. for de-DE locale), because they break for developers on Windows. But, I haven't tried this myself, so I can't say for sure.

@clouserw
Copy link
Member Author

Thanks for the updates, @relud.

Regarding that npm error, the legal-docs repository doesn't have an index.json so it can't be require()'d, but we're not doing that, so it should be fine. It looks like the browser-resolve package (part of browserify?) is iterating all the packages and apparently trying to load them? That's a guess and this is a bit out of my depth. @fzzzy (or anyone) is this something you've seen before and/or easy to fix?

(side note) It looks like we're only using browserify in one place - do we need it?

@lmorchard
Copy link
Contributor

lmorchard commented Mar 29, 2017

(side note) It looks like we're only using browserify in one place - do we need it?

We're using Browserify in a few places - mainly here to build the app.js & vendor.js bundles that run the web frontend.

@fzzzy
Copy link
Contributor

fzzzy commented Mar 29, 2017

@clouserw Given that Windows may not be happy with symlinks, and that the legal docs repo doesn't have a package.json which is causing problems, how about just adding an npm script that does a curl or wget and then moves things into the right place? Then we can just run it manually whenever updates are desired.

@fzzzy
Copy link
Contributor

fzzzy commented Mar 29, 2017

Alternatively, we could add a package.json to the legal repo (with just generic metadata fields) and change the gulp task that looks for the md files in compiled-templates to look for them in node_modules. That should work without problems on windows.

@clouserw
Copy link
Member Author

@fzzzy and I chatted on IRC. New patch fixes the crash. I think this is good to go for engineering. Brian Smith is following up on the de vs de-DE question.

@learnedhoof
Copy link

@clouserw that was done by the localization team -- i don't know that there's a specific reason.

@learnedhoof
Copy link

@clouserw submitted PRs for changing from de-DE to de
mozilla/legal-docs#771
and mozilla/legal-docs#772

@clouserw
Copy link
Member Author

Thanks @eleemoz . Those are closed now, so landing this.

@clouserw clouserw merged commit fc4dcff into mozilla:master Apr 10, 2017
@ghost ghost removed the status:inreview label Apr 10, 2017
@clouserw
Copy link
Member Author

@SoftVision-PaulOiegas @SoftVision-CosminMuntean -- pinging you on this too. If this goes wrong, the legal docs won't show up on dev (potentially, just the german version also)

@fzzzy fzzzy mentioned this pull request May 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants