From c6c1cba538934fbfd16f7895790d319e10c598f2 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 12:23:12 +0100 Subject: [PATCH 01/10] Fixed yum clean all. Indent for better readability --- Dockerfile | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1052adf..3f05252 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,30 +18,30 @@ LABEL maintainer="toolkit@shotgunsoftware.com" RUN yum update -y && \ yum install -y epel-release && \ yum install -y \ - # Generic build packages - autoconf \ - automake \ - gcc \ - gcc-c++ \ - git \ - libtool \ - make \ - nasm \ - perl-devel \ - zlib-devel \ - tar \ - nc \ - xz \ - # sphinx - pandoc \ - # Python libs - python-pip \ - # Ruby - libyaml-devel \ - openssl-devel \ - libreadline-dev \ - zlib-devel \ - python-pyside \ + # Generic build packages + autoconf \ + automake \ + gcc \ + gcc-c++ \ + git \ + libtool \ + make \ + nasm \ + perl-devel \ + zlib-devel \ + tar \ + nc \ + xz \ + # sphinx + pandoc \ + # Python libs + python-pip \ + # Ruby + libyaml-devel \ + openssl-devel \ + libreadline-dev \ + zlib-devel \ + python-pyside && \ yum clean all # Ruby From 73f3d1934bb25407af0e4f00da6cdaadd50725b2 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 12:27:10 +0100 Subject: [PATCH 02/10] Fixed root only permissions --- scripts/build_docs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build_docs.sh b/scripts/build_docs.sh index b7f0adf..067c851 100755 --- a/scripts/build_docs.sh +++ b/scripts/build_docs.sh @@ -97,6 +97,8 @@ else --source "${TMP_BUILD_FOLDER}" --destination "${OUTPUT}" fi +# Local preview_docs.sh (Docker): allow non-root users to modify generated docs +chmod -R 'a+rwX' "${OUTPUT}" echo "------------------------------------------------------" echo "Build completed." echo "------------------------------------------------------" From f21367931fdb18b73fdfec7f443f1c1add9b3881 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 12:33:56 +0100 Subject: [PATCH 03/10] Using WWFX DOC_URL --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 159a33a..8a900e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,8 @@ python: env: global: - - DOC_URL=https://developer.shotgunsoftware.com + - DOC_URL=https://wwfxuk.github.io - DOC_PATH=/tk-doc-generator - - S3_BUCKET=sg-devdocs - - S3_WEB_URL=http://sg-devdocs.s3-website-us-east-1.amazonaws.com cache: pip: true @@ -54,4 +52,4 @@ deploy: github-token: $GITHUB_TOKEN on: # only do this when on the master branch - branch: master + branch: fix-build-docs-rwX-yum-clean-all From 2d06e7171ad2bb415ae4bb707dce677f443db5b0 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 12:46:17 +0100 Subject: [PATCH 04/10] Added changelog --- .travis.yml | 3 ++- docs/_data/en/toc_text.yml | 3 ++- docs/_data/toc.yml | 4 ++++ docs/en/changelog.md | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docs/en/changelog.md diff --git a/.travis.yml b/.travis.yml index 8a900e5..fe60ec1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: global: - DOC_URL=https://wwfxuk.github.io - DOC_PATH=/tk-doc-generator + # We don't have S3, seems like it is optional anyways cache: pip: true @@ -52,4 +53,4 @@ deploy: github-token: $GITHUB_TOKEN on: # only do this when on the master branch - branch: fix-build-docs-rwX-yum-clean-all + branch: master diff --git a/docs/_data/en/toc_text.yml b/docs/_data/en/toc_text.yml index f5be72d..b2bdecd 100644 --- a/docs/_data/en/toc_text.yml +++ b/docs/_data/en/toc_text.yml @@ -1,8 +1,9 @@ # Translated text strings used by the table of contents -# +# # For documentation, see https://developer.shotgunsoftware.com/tk-doc-generator/authoring/toc/ # +overview: Overview authoring: Authoring docs markdown-cheatsheet: Markdown Format setting-up: Installation diff --git a/docs/_data/toc.yml b/docs/_data/toc.yml index 59c10d7..afbd309 100644 --- a/docs/_data/toc.yml +++ b/docs/_data/toc.yml @@ -4,6 +4,10 @@ # # +- caption: overview + children: + - page: changelog + - caption: authoring children: - page: authoring diff --git a/docs/en/changelog.md b/docs/en/changelog.md new file mode 100644 index 0000000..6174a26 --- /dev/null +++ b/docs/en/changelog.md @@ -0,0 +1,34 @@ +--- +layout: default +title: Change Log/History +pagename: changelog +lang: en +--- + +Change Log/History +------------------ + +See also the [GitHub Releases page][releases] + +[releases]: https://github.com/wwfxuk/tk-doc-generator/releases + +# v1.0.0+wwfx.0.1.0 + +Added this change log as well as minor fixes: + +## .travis.yml + +- Changed to WWFX UK `DOC_URL` + +## Dockerfile + +- Fixed `yum clean all` from being part of the `yum install` arguments + +## build_docs.sh + +- Fixed permissions of generated docs from just `root` only + + +# v1.0.0 + +Initial release from Shotgun, nothing mentioned by Shotgun. \ No newline at end of file From deacbbf1445bfab1ca38dc74ce1783bd7ab50c44 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 13:14:14 +0100 Subject: [PATCH 05/10] Fixed URL root issues --- travis-generate-docs.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/travis-generate-docs.py b/travis-generate-docs.py index f7869e3..b881d81 100755 --- a/travis-generate-docs.py +++ b/travis-generate-docs.py @@ -126,6 +126,11 @@ def main(): # first figure out i we are on master or in a PR. if current_branch != "master" or inside_pr: + # Defaults: No S3, dummy domain url and empty sub-folder path + s3_bucket = None + target_url = "https://dummy.url.com" + target_url_path = "/" + # we are in a PR. log.info("Inside a pull request.") @@ -142,11 +147,16 @@ def main(): else: log.warning("No S3_BUCKET and S3_WEB_URL detected in environment. " "No S3 preview will be generated") - s3_bucket = None - # enter dummy paths so we can at least build - # the docs to check for errors - target_url = "https://dummy.url.com" - target_url_path = "/" + + # Use DOC_* for target + if "DOC_URL" in os.environ and "DOC_PATH" in os.environ: + log.info("Using DOC_URL/PATH.") + target_url = os.environ["DOC_URL"] + target_url_path = os.environ["DOC_PATH"] + else: + log.warning("Using dummy paths so we can at least build the docs " + "to check for errors") + target_full_url = "{url}{path}/index.html".format(url=target_url, path=target_url_path) From 40c640df941c54dd465041282d3b1c7f5a6d10ba Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 14:23:09 +0100 Subject: [PATCH 06/10] Spelling fix, testing build --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fe60ec1..f84ceff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ script: - python ./travis-generate-docs.py deploy: - # When commiting to master, auto-deploy to github-pages + # When committing to master, auto-deploy to github-pages # This will copy the contents of the _build folder to gh-pages branch and push - provider: pages local-dir: ./_build @@ -53,4 +53,4 @@ deploy: github-token: $GITHUB_TOKEN on: # only do this when on the master branch - branch: master + branch: fix-build-docs-rwX-yum-clean-all From 082bdca968e587eccc7171f4c890e92cc8ee0a7a Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 14:34:16 +0100 Subject: [PATCH 07/10] Updated changelogs, ready to merge --- .travis.yml | 3 +-- docs/en/changelog.md | 16 ++++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index f84ceff..d8d6aa9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ env: global: - DOC_URL=https://wwfxuk.github.io - DOC_PATH=/tk-doc-generator - # We don't have S3, seems like it is optional anyways cache: pip: true @@ -53,4 +52,4 @@ deploy: github-token: $GITHUB_TOKEN on: # only do this when on the master branch - branch: fix-build-docs-rwX-yum-clean-all + branch: master diff --git a/docs/en/changelog.md b/docs/en/changelog.md index 6174a26..fed09af 100644 --- a/docs/en/changelog.md +++ b/docs/en/changelog.md @@ -16,18 +16,10 @@ See also the [GitHub Releases page][releases] Added this change log as well as minor fixes: -## .travis.yml - -- Changed to WWFX UK `DOC_URL` - -## Dockerfile - -- Fixed `yum clean all` from being part of the `yum install` arguments - -## build_docs.sh - -- Fixed permissions of generated docs from just `root` only - +- `.travis.yml`: Changed to WWFX UK `DOC_URL` +- `Dockerfile`: Fixed `yum clean all` from being part of the `yum install` arguments +- `build_docs.sh`: Fixed permissions of generated docs from just `root` only +- `travis-generate-docs.py`: Fallback to `DOC_*` before using dummy URL. # v1.0.0 From cdc8657c5269385db2186de8089073519bde96b7 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 3 Jun 2019 15:01:15 +0100 Subject: [PATCH 08/10] Converted to shotgunsoftware URLs --- .travis.yml | 4 +++- docs/en/changelog.md | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d8d6aa9..29cce39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,10 @@ python: env: global: - - DOC_URL=https://wwfxuk.github.io + - DOC_URL=https://developer.shotgunsoftware.com - DOC_PATH=/tk-doc-generator + - S3_BUCKET=sg-devdocs + - S3_WEB_URL=http://sg-devdocs.s3-website-us-east-1.amazonaws.com cache: pip: true diff --git a/docs/en/changelog.md b/docs/en/changelog.md index fed09af..482594a 100644 --- a/docs/en/changelog.md +++ b/docs/en/changelog.md @@ -10,13 +10,12 @@ Change Log/History See also the [GitHub Releases page][releases] -[releases]: https://github.com/wwfxuk/tk-doc-generator/releases +[releases]: https://github.com/shotgunsoftware/tk-doc-generator/releases -# v1.0.0+wwfx.0.1.0 +# v1.x.x Added this change log as well as minor fixes: -- `.travis.yml`: Changed to WWFX UK `DOC_URL` - `Dockerfile`: Fixed `yum clean all` from being part of the `yum install` arguments - `build_docs.sh`: Fixed permissions of generated docs from just `root` only - `travis-generate-docs.py`: Fallback to `DOC_*` before using dummy URL. From e0f9170ef616df1f4169ea06659e75db090f3e48 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Fri, 7 Jun 2019 17:54:23 +0100 Subject: [PATCH 09/10] Better S3 detection --- travis-generate-docs.py | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/travis-generate-docs.py b/travis-generate-docs.py index b881d81..c3b7ccd 100755 --- a/travis-generate-docs.py +++ b/travis-generate-docs.py @@ -124,39 +124,32 @@ def main(): current_branch = os.environ.get("TRAVIS_BRANCH") inside_pr = os.environ.get("TRAVIS_PULL_REQUEST") != "false" - # first figure out i we are on master or in a PR. + # first figure out if we are on master or in a PR. if current_branch != "master" or inside_pr: - # Defaults: No S3, dummy domain url and empty sub-folder path - s3_bucket = None - target_url = "https://dummy.url.com" - target_url_path = "/" + log.info("Inside a pull request (or not master branch).") - # we are in a PR. - log.info("Inside a pull request.") - - # see if we have access to an AWS bucket - if "S3_BUCKET" in os.environ and "S3_WEB_URL" in os.environ: + # See if we have access to an AWS bucket + s3_bucket = os.getenv("S3_BUCKET", default=None) + target_url = os.getenv("S3_WEB_URL", default=None) + if s3_bucket and target_url: log.info("Detected AWS S3 bucket for preview workflow.") - - s3_bucket = os.environ["S3_BUCKET"] - target_url = os.environ["S3_WEB_URL"] - target_url_path = "/tk-doc-generator/{commit}".format( - commit=os.environ["TRAVIS_COMMIT"] - ) - + target_url_path = "/tk-doc-generator/{env[TRAVIS_COMMIT]}" + target_url_path = target_url_path.format(env=os.environ) else: log.warning("No S3_BUCKET and S3_WEB_URL detected in environment. " "No S3 preview will be generated") - # Use DOC_* for target - if "DOC_URL" in os.environ and "DOC_PATH" in os.environ: + # Then try use DOC_* for target + target_url = os.getenv("DOC_URL", default=None) + target_url_path = os.getenv("DOC_PATH", default=None) + if target_url and target_url_path: log.info("Using DOC_URL/PATH.") - target_url = os.environ["DOC_URL"] - target_url_path = os.environ["DOC_PATH"] else: + # Fall back to using root directly on dummy domain url log.warning("Using dummy paths so we can at least build the docs " "to check for errors") - + target_url = "https://dummy.url.com" + target_url_path = "/" target_full_url = "{url}{path}/index.html".format(url=target_url, path=target_url_path) From 6e64fc681943dedb5ed8bb25ce236f28c0ff429d Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Fri, 7 Jun 2019 18:06:47 +0100 Subject: [PATCH 10/10] Better S3 access detection --- travis-generate-docs.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/travis-generate-docs.py b/travis-generate-docs.py index c3b7ccd..ce40006 100755 --- a/travis-generate-docs.py +++ b/travis-generate-docs.py @@ -163,12 +163,14 @@ def main(): ) execute_external_command(doc_command) - if s3_bucket: + aws_access_key = os.getenv("AWS_S3_ACCESS_KEY", default=None) + aws_access_token = os.getenv("AWS_S3_ACCESS_TOKEN", default=None) + if s3_bucket and aws_access_key and aws_access_token: log.info("Uploading build result to S3...") s3_client = boto3.client( "s3", - aws_access_key_id=os.environ["AWS_S3_ACCESS_KEY"], - aws_secret_access_key=os.environ["AWS_S3_ACCESS_TOKEN"] + aws_access_key=aws_access_key, + aws_access_token=aws_access_token ) # note: skip the first slash when uploading to S3