Skip to content

Add build scripts v2 #32

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

Merged

Conversation

williamcroberts
Copy link

Add build scripts to make building documentation from source markdown simpler for end users.

TODO:

  • Add a test for the docker container
  • Figure out workflows.

Current Issues I see:

The PR builds and publishes docker container
a. Requires perms on incoming PRs which should be treated as untrusted even through it's inter-org. Don't trust Bill.
b. PRs race on publishing the image

Proposal: for PRs and pushes, do a docker build and docker run manually. The images for github actions contain all the
docker things, no need to really use the composite actions or reusable workflows for that. Only on push should publish the
container to the registry. Do we really need to publish and check-in the generated files?

Composite Workflows
IIUC it's a composite workflow others are using to generate the markdown rendering. However, it requires users to setup the docker container. I think if we move to a reusable workflow, we can move all of the setup into a reusable workflow so callers of the workflow don't have to do anything but use it. Additionally we can just use docker_run, no real need for the docker actions as docker run will pull the image.

markdown project
Do we need this? The pandoc project builds out the samples anyways, couldn't we just coalesce them or is the markdown project exist soley to test the action.yml composite workflow? It seems confusing to have so much stuff spread out, i'm not seeing the value in the decomposition.

William Roberts added 3 commits November 29, 2022 15:14
Fixes:
Error producing PDF.
! LaTeX Error: File `hardwrap.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:
! Emergency stop.
<read *>

l.49 \RequirePackage{hardwrap}[2011/02/12]

Signed-off-by: William Roberts <[email protected]>
Fixes:
! LaTeX Error: File `catchfile.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:
! Emergency stop.
<read *>

l.14 \newif

Signed-off-by: William Roberts <[email protected]>
Add a script build.sh that runs all the pre-processing and build steps
required for the user. This will help pull out steps from the github
action so folks can build locally.

Update the docker file to pull in said build.sh script.

Signed-off-by: William Roberts <[email protected]>
@williamcroberts williamcroberts mentioned this pull request Dec 1, 2022
William Roberts added 2 commits December 5, 2022 14:07
Use git-describe --always --tags formating to determing document version
and revision according to the following semantics:

- no tag (commit abcdefg12345): version 0.0 revision is count of commits
  on branch.
- tag major: version major.0 revision 0
- tag major w/commits: version major.0 revision is count of commits over
  tag.
- tag major.minor: version major.minor revision 0
- tag major.minor w/commits: version major.minor revision is count of commits over
  tag.

Fixes: TrustedComputingGroup#31

Signed-off-by: William Roberts <[email protected]>
Containers need to be launched in a specific way to make things
available to the container at run time and ensure uid/gid settings are
preserved. To simplify this, add a wrapper script.

Example run from markdown repo as CWD:
DOCKER_IMAGE=c53378db2a42 ../pandoc/docker_run --pdf=bill.pdf sample1.md
Starting Build with
file: sample1.md
puppeteer: no
docx: none
pdf: bill.pdf
latex: none
use tmp: yes
resource dir: /
build dir: /tmp/tmp.pGvXefGXaT
browser: /usr/bin/chromium-browser

Signed-off-by: William Roberts <[email protected]>
William Roberts added 2 commits December 14, 2022 14:37
Use the git describe output to determine the document status
of DRAFT or PUBLISHED. A hard git tag results in PUBLISHED and something
not on a tag results in DRAFT.

git tag 4.0
/build.sh --gitstatus --pdf=1.pdf sample1.md
Git Generated Document Version Information
    version: 4.0
    revision: 0
    status: PUBLISHED

git tag -d 4.0
/build.sh --gitstatus --pdf=1.pdf sample1.md
Git Generated Document Version Information
    version: 0.3.1
    revision: 6
    status: DRAFT

Signed-off-by: William Roberts <[email protected]>
mktexpk uses a home directory for generation and its not clear how to
change this behavior or pass options through pandoc. Thus, give it what
it wants by exporting HOME to /home/user and setting the mode to 0777 so
that it can be utilized by whatever uid is mounted into the container.

Fix errors like:
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 tctt1000
mkdir: cannot create directory ‘././.texlive’: Permission denied
mktexpk: /opt/texlive/texdir/texmf-dist/web2c/mktexdir /.texlive/texmf-var/fonts/pk/ljfour/jknappen/ec failed.
kpathsea: Appending font creation commands to missfont.log.

Signed-off-by: William Roberts <[email protected]>
Signed-off-by: William Roberts <[email protected]>
@chrisfenner
Copy link
Member

Hi Bill, sorry this languished. Holidays and other urgent matters appeared in December, and now it's April. This PR has a lot of great stuff in it, thanks for all this!

I'm going to go ahead and merge this as a 1st step for some fixes I'm working on. Your points are well taken in "Current Issues;" I will file some GH issues based on this feedback. I especially think that with the script work here, the markdown repo gets a lot thinner (to the point of just hosting the GH action and none of the "fixups")

@chrisfenner chrisfenner merged commit c828544 into TrustedComputingGroup:main Apr 10, 2023
@chrisfenner
Copy link
Member

Filed #37 and #38

@williamcroberts
Copy link
Author

Hi Bill, sorry this languished. Holidays and other urgent matters appeared in December, and now it's April. This PR has a lot of great stuff in it, thanks for all this!

I'm going to go ahead and merge this as a 1st step for some fixes I'm working on. Your points are well taken in "Current Issues;" I will file some GH issues based on this feedback. I especially think that with the script work here, the markdown repo gets a lot thinner (to the point of just hosting the GH action and none of the "fixups")

Yeah that was the goal. Thanks.

@williamcroberts williamcroberts deleted the add-build-scripts branch April 11, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically count revisions based on Git commit count
2 participants