-
Notifications
You must be signed in to change notification settings - Fork 2
[WIP] Add update.py semi-automatic release crawler #1
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
Changes from 1 commit
c82d748
9e95510
ceabc10
85b28fa
17426d6
f8d1237
dd743ee
f78da21
baa6dd9
9028e80
94d05bf
ccd763e
b391051
ba95f26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| tag_filter: &tag_filter | ||
| filters: | ||
| tags: | ||
| only: /.*/ | ||
| branches: | ||
| ignore: /.*/ | ||
|
|
||
| version: 2 | ||
| jobs: | ||
| build: | ||
| machine: | ||
| image: circleci/classic:latest | ||
| steps: | ||
| - checkout | ||
| - run: | ||
| name: Build Docker image | ||
| command: | | ||
| git describe --tags --always > version | ||
| docker build -t octomike/${CIRCLE_PROJECT_REPONAME,,} . | ||
| mkdir -p ${HOME}/docker | ||
| docker save "octomike/${CIRCLE_PROJECT_REPONAME,,}" > ~/docker/image.tar | ||
| no_output_timeout: 30m # MCR is a large download | ||
| - persist_to_workspace: | ||
| root: /home/circleci | ||
| paths: | ||
| - docker/image.tar | ||
| test: | ||
| machine: | ||
| image: circleci/classic:latest | ||
| steps: | ||
| - attach_workspace: | ||
| at: /tmp/workspace | ||
| - run: | ||
| name: Test Docker image | ||
| command: | | ||
| docker load -i /tmp/workspace/docker/image.tar | ||
| # figure out a better test | ||
| docker run -ti --rm --read-only --entrypoint /bin/sh octomike/${CIRCLE_PROJECT_REPONAME,,} -c 'test -d $MCRPath/runtime/glnxa64' | ||
| deploy: | ||
| docker: | ||
| - image: circleci/buildpack-deps:stretch | ||
| steps: | ||
| - attach_workspace: | ||
| at: /tmp/workspace | ||
| - setup_remote_docker | ||
| - run: docker load -i /tmp/workspace/docker/image.tar | ||
| - run: | ||
| name: Publish Docker image | ||
| command: | | ||
| if [[ -n "${CIRCLE_TAG}" ]]; then | ||
| echo "${DOCKER_PASS}" | docker login --username "${DOCKER_USER}" --password-stdin | ||
| docker tag octomike/${CIRCLE_PROJECT_REPONAME,,} octomike/${CIRCLE_PROJECT_REPONAME,,}:${CIRCLE_TAG} | ||
| docker push octomike/${CIRCLE_PROJECT_REPONAME,,}:${CIRCLE_TAG} | ||
| # for tags like 9.7.5-core, share a major tag 9.7-core as well | ||
| MAJOR_TAG=$(echo "${CIRCLE_TAG}" | sed -rn 's#([[:digit:]]+).([[:digit:]]+).([[:digit:]]+)(.*)#\1.\2\4#p') | ||
| if [[ -n "${MAJOR_TAG}" ]] ; then | ||
| docker tag octomike/${CIRCLE_PROJECT_REPONAME,,} octomike/${CIRCLE_PROJECT_REPONAME,,}:${MAJOR_TAG} | ||
| docker push octomike/${CIRCLE_PROJECT_REPONAME,,}:${MAJOR_TAG} | ||
| fi | ||
| fi | ||
| workflows: | ||
| version: 2 | ||
| build-test-deploy: | ||
| jobs: | ||
| - build: | ||
| <<: *tag_filter | ||
| - test: | ||
| requires: | ||
| - build | ||
| <<: *tag_filter | ||
| - deploy: | ||
| requires: | ||
| - test | ||
| <<: *tag_filter | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| FROM bids/base_validator | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only BIDS-related item: why not base directly on,e.g., ubuntu?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea why this is the base image. Is it containing something that BIDS-Apps expect? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't remember now but given the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That one could probably be based on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
perhaps. 🤷♂️ I'll ask about this in an upcoming meeting with other BIDS folks who may know. |
||
|
|
||
| # Update system | ||
| RUN apt-get -qq update && apt-get -qq install -y \ | ||
| unzip \ | ||
| xorg \ | ||
| wget && \ | ||
| rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
|
||
| # Install MATLAB MCR | ||
| ENV MATLAB_VERSION %%MATLAB_VERSION%% | ||
| RUN mkdir /opt/mcr_install && \ | ||
| mkdir /opt/mcr && \ | ||
| wget --quiet -P /opt/mcr_install %%MCR_LINK%% && \ | ||
| unzip -q /opt/mcr_install/*${MATLAB_VERSION}*.zip -d /opt/mcr_install && \ | ||
| cd /opt/mcr_install && mkdir save && \ | ||
| for f in $(grep -E '(xml|enc)$' productdata/1000.txt) ; do cp --parents archives/$f save/ ; done && \ | ||
| for f in $(grep -E '(xml|enc)$' productdata/35000.txt) ; do cp --parents archives/$f save/ ; done && \ | ||
| for f in $(grep -E '(xml|enc)$' productdata/35010.txt) ; do cp --parents archives/$f save/ ; done && \ | ||
| rm -rf archives && mv save/archives . && rmdir save && \ | ||
| /opt/mcr_install/install -destinationFolder /opt/mcr -agreeToLicense yes -mode silent && \ | ||
| rm -rf /opt/mcr_install /tmp/* && \ | ||
| rm -rf /opt/mcr/*/cefclient && \ | ||
| rm -rf /opt/mcr/*/mcr/toolbox/matlab/maps && \ | ||
| rm -rf /opt/mcr/*/java/jarext && \ | ||
| rm -rf /opt/mcr/*/toolbox/matlab/system/editor && \ | ||
| rm -rf /opt/mcr/*/toolbox/matlab/codetools && \ | ||
| rm -rf /opt/mcr/*/toolbox/matlab/datatools && \ | ||
| rm -rf /opt/mcr/*/toolbox/matlab/codeanalysis && \ | ||
| rm -rf /opt/mcr/*/toolbox/shared/dastudio && \ | ||
| rm -rf /opt/mcr/*/toolbox/shared/mlreportgen && \ | ||
| rm -rf /opt/mcr/*/sys/java/jre/glnxa64/jre/lib/ext/jfxrt.jar && \ | ||
| rm -rf /opt/mcr/*/sys/java/jre/glnxa64/jre/lib/amd64/libjfxwebkit.so && \ | ||
| rm -rf /opt/mcr/*/bin/glnxa64/libQt* && \ | ||
| rm -rf /opt/mcr/*/bin/glnxa64/qtwebengine && \ | ||
| rm -rf /opt/mcr/*/bin/glnxa64/cef_resources | ||
|
|
||
| # Configure environment | ||
| ENV MCR_VERSION %%MCR_VERSION%% | ||
| ENV LD_LIBRARY_PATH /opt/mcr/${MCR_VERSION}/runtime/glnxa64:/opt/mcr/${MCR_VERSION}/bin/glnxa64:/opt/mcr/${MCR_VERSION}/sys/os/glnxa64:/opt/mcr/${MCR_VERSION}/sys/opengl/lib/glnxa64 | ||
| ENV MCR_INHIBIT_CTF_LOCK 1 | ||
| ENV MCRPath /opt/mcr/${MCR_VERSION} | ||
Remi-Gau marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,116 @@ | ||||||
| #!/usr/bin/env python3 | ||||||
| """ | ||||||
| Dirty website parser to generate Dockerfiles for Matlab's MCR releases. | ||||||
|
|
||||||
| Each Matlab release name (R2020a etc) gets a branch that contains a single | ||||||
| Dockerfile and each release version (9.8.0 or 9.8.5 for 9.8 Update 5) becomes | ||||||
| a tag in that branch. Each variant gets a new commit as well. | ||||||
| So a sample history for R2020a could look something like this: | ||||||
|
|
||||||
| + [R2020a] <9.8.1-core> Auto-Update | ||||||
| + <9.8.1> Auto-Update | ||||||
| + Merged master | ||||||
| | \ | ||||||
| | + Update in templates | ||||||
| | / | ||||||
| + <9.8.0-core> Auto-Update | ||||||
| + <9.8.0> Auto-Update | ||||||
| + <master> Import | ||||||
|
|
||||||
| (Circle)CI should then fire a docker build and push for every tag only. Shared | ||||||
| tags for the major version (e.g. 9.8 always pointing to the latest 9.8 tag are | ||||||
| done in Circle CI to avoid duplicate builds). | ||||||
|
|
||||||
| Update.py should be run often enough to catch individual matlab releae updates. | ||||||
|
||||||
| Update.py should be run often enough to catch individual matlab releae updates. | |
| Update.py should be run often enough to catch individual matlab release updates. |
I don't get the "semi updating" process yet. Does it mean a potential maintainer regularly runs update.py from their machine and then commits and pushes any changes?
Are tags generated automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now update.py is simply generating git tags in separate branches and afterwards outputs necessary git commands to trigger circleCI actually building new images based on git tags.
Example output would be:
Adding R2020a/9.8.0
Adding R2020a/9.8.0-core
Adding R2019b/9.7.5
Adding R2019b/9.7.5-core
Adding R2019a/9.6.8
Adding R2019a/9.6.8-core
Adding R2018b/9.5.0
Adding R2018b/9.5.0-core
Adding R2018a/9.4.0
Adding R2018a/9.4.0-core
New tags have been added, verify and update to git with:
git push --all
git push origin 9.4.0-core
git push origin 9.4.0
git push origin 9.5.0-core
git push origin 9.5.0
git push origin 9.6.8-core
git push origin 9.6.8
git push origin 9.7.5-core
git push origin 9.7.5
git push origin 9.8.0-core
git push origin 9.8.0
Those last git push lines can easily be automated away of course but my experience with Matlab tells me that it will still require minor changes once in a while, so this semi-automated process boils down to:
- run update.py
- inspect and potentially fix new releases (minor changes in the URL probably)
- git push all the things
That shouldn't take more than 5 minutes every other month or so.
Uh oh!
There was an error while loading. Please reload this page.