Skip to content

Commit 54ad6e1

Browse files
authored
Merge pull request #1 from octomike/feature_release_crawler
[WIP] Add update.py semi-automatic release crawler
2 parents b097837 + ba95f26 commit 54ad6e1

File tree

10 files changed

+316
-48
lines changed

10 files changed

+316
-48
lines changed

.circleci/config.yml

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,66 @@
11
---
2+
tag_filter: &tag_filter
3+
filters:
4+
tags:
5+
only: /.*/
6+
branches:
7+
ignore: /.*/
8+
29
version: 2.1
310

411
jobs:
12+
513
build:
614
machine:
7-
# https://circleci.com/developer/machine/image/ubuntu-2204
815
image: ubuntu-2204:2022.10.2
916
steps:
1017
- checkout
11-
- restore_cache:
12-
keys:
13-
- my_cache
1418
- run:
1519
name: Build Docker image
16-
command: |
17-
wget https://raw.githubusercontent.com/bids-apps/maintenance-tools/main/circleci/build_docker.sh
18-
bash build_docker.sh
19-
- save_cache:
20-
key: my_cache
21-
paths:
22-
- ~/docker
20+
command: bash build_docker.sh
21+
no_output_timeout: 30m # MCR is a large download
2322
- persist_to_workspace:
2423
root: /home/circleci
2524
paths:
2625
- docker/image.tar
2726

28-
deploy:
27+
test:
2928
machine:
3029
image: ubuntu-2204:2022.10.2
3130
steps:
3231
- attach_workspace:
3332
at: /tmp/workspace
34-
- run: docker load -i /tmp/workspace/image.tar
3533
- run:
36-
name: push to dockerhub
34+
name: Test Docker image
3735
command: |
38-
wget https://raw.githubusercontent.com/bids-apps/maintenance-tools/main/circleci/push_docker.sh
39-
bash push_docker.sh
36+
docker load -i /tmp/workspace/docker/image.tar
37+
# figure out a better test
38+
docker run -ti --rm --read-only \
39+
--entrypoint /bin/sh bids/${CIRCLE_PROJECT_REPONAME,,} \
40+
-c 'test -d ${MCR_HOME}/runtime/glnxa64'
4041
42+
deploy:
43+
docker:
44+
- image: circleci/buildpack-deps:stretch
45+
steps:
46+
- attach_workspace:
47+
at: /tmp/workspace
48+
- setup_remote_docker
49+
- run: docker load -i /tmp/workspace/docker/image.tar
50+
- run:
51+
name: Publish Docker image
52+
command: push_docker.sh
4153

4254
workflows:
4355
build-test-deploy:
4456
jobs:
45-
- build
46-
- deploy:
57+
- build:
58+
<<: *tag_filter
59+
- test:
4760
requires:
4861
- build
49-
filters:
50-
tags:
51-
only: /.*/
52-
53-
# VS Code Extension Version: 1.5.1
62+
<<: *tag_filter
63+
- deploy:
64+
requires:
65+
- test
66+
<<: *tag_filter

.hadolint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
22
ignored:
3+
- DL3003
34
- DL3006
45
- DL3008
6+
- SC2086

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,27 @@ repos:
3232
types: [dockerfile]
3333
entry: ghcr.io/hadolint/hadolint hadolint
3434

35+
- repo: https://github.com/psf/black
36+
rev: 22.12.0
37+
hooks:
38+
- id: black
39+
40+
- repo: https://github.com/asottile/pyupgrade
41+
rev: v3.3.1
42+
hooks:
43+
- id: pyupgrade
44+
args: [--py38-plus]
45+
46+
- repo: https://github.com/pycqa/flake8
47+
rev: 6.0.0
48+
hooks:
49+
- id: flake8
50+
51+
- repo: https://github.com/asottile/reorder_python_imports
52+
rev: v3.9.0
53+
hooks:
54+
- id: reorder-python-imports
55+
args: [--py38-plus]
56+
3557
ci:
3658
skip: [hadolint-docker]

Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

build_docker.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#! /bin/bash
2+
3+
# used to build the Docker image for a project in circle CI
4+
5+
git describe --tags --always > version
6+
docker build -t "bids/${CIRCLE_PROJECT_REPONAME,,}" .
7+
mkdir -p ${HOME}/docker
8+
docker save "bids/${CIRCLE_PROJECT_REPONAME,,}" > ~/docker/image.tar
9+
# persist guessed branch so we can use it in deploy/tag
10+
BRANCH=$(git branch --contains tags/${CIRCLE_TAG})
11+
echo -n "${BRANCH}" > ~/docker/branch

push_docker.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#! /bin/bash
2+
3+
# used to push the Docker image for a project in circle CI
4+
5+
if [[ -n "${CIRCLE_TAG}" ]]; then
6+
7+
echo "${DOCKER_PASS}" | docker login --username "${DOCKER_USER}" --password-stdin
8+
9+
# tag should always be X.Y.Z[-variant]
10+
docker tag "bids/${CIRCLE_PROJECT_REPONAME,,}" "bids/${CIRCLE_PROJECT_REPONAME,,}:${CIRCLE_TAG}"
11+
docker push "bids/${CIRCLE_PROJECT_REPONAME,,}:${CIRCLE_TAG}"
12+
13+
# also publish tag for the corresponding matlab release version, which is the name of the current branch
14+
docker "tag bids/${CIRCLE_PROJECT_REPONAME,,}" "bids/${CIRCLE_PROJECT_REPONAME,,}:${BRANCH}"
15+
docker push "bids/${CIRCLE_PROJECT_REPONAME,,}:${BRANCH}"
16+
BRANCH=$(cat /tmp/workspace/docker/branch)
17+
18+
# update major tag X.Y[-variant] to the latest in this branch
19+
MAJOR_TAG=$(echo "${CIRCLE_TAG}" | sed -rn 's#([[:digit:]]+).([[:digit:]]+).([[:digit:]]+)(.*)#\1.\2\4#p')
20+
if [[ -n "${MAJOR_TAG}" ]] ; then
21+
docker tag "bids/${CIRCLE_PROJECT_REPONAME,,}" "bids/${CIRCLE_PROJECT_REPONAME,,}:${MAJOR_TAG}"
22+
docker push "bids/${CIRCLE_PROJECT_REPONAME,,}:${MAJOR_TAG}"
23+
fi
24+
25+
fi

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rich
2+
beautifulsoup4
3+
packaging
4+
chevron

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 100

template.mustache

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM bids/base_validator
2+
3+
# Update system
4+
RUN apt-get -qq update -qq && \
5+
apt-get -qq install -qq -y --no-install-recommends \
6+
unzip \
7+
xorg \
8+
wget && \
9+
apt-get clean && \
10+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11+
12+
# Install MATLAB MCR
13+
ENV MATLAB_VERSION {{ MATLAB_VERSION }}
14+
RUN mkdir /opt/mcr_install && \
15+
mkdir /opt/mcr && \
16+
wget --quiet -P /opt/mcr_install {{ MCR_LINK }} && \
17+
unzip -q /opt/mcr_install/*${MATLAB_VERSION}*.zip -d /opt/mcr_install && \
18+
cd /opt/mcr_install && mkdir save && \
19+
{{#core_only}}
20+
for f in $(grep -E '(xml|enc)$' productdata/1000.txt) ; do cp --parents archives/$f save/ ; done && \
21+
for f in $(grep -E '(xml|enc)$' productdata/35000.txt) ; do cp --parents archives/$f save/ ; done && \
22+
for f in $(grep -E '(xml|enc)$' productdata/35010.txt) ; do cp --parents archives/$f save/ ; done && \
23+
rm -rf archives && mv save/archives . && rmdir save && \
24+
{{/core_only}}
25+
/opt/mcr_install/install -destinationFolder /opt/mcr -agreeToLicense yes -mode silent && \
26+
{{#core_only}}
27+
rm -rf /opt/mcr/*/cefclient && \
28+
rm -rf /opt/mcr/*/mcr/toolbox/matlab/maps && \
29+
rm -rf /opt/mcr/*/java/jarext && \
30+
rm -rf /opt/mcr/*/toolbox/matlab/system/editor && \
31+
rm -rf /opt/mcr/*/toolbox/matlab/codetools && \
32+
rm -rf /opt/mcr/*/toolbox/matlab/datatools && \
33+
rm -rf /opt/mcr/*/toolbox/matlab/codeanalysis && \
34+
rm -rf /opt/mcr/*/toolbox/shared/dastudio && \
35+
rm -rf /opt/mcr/*/toolbox/shared/mlreportgen && \
36+
rm -rf /opt/mcr/*/sys/java/jre/glnxa64/jre/lib/ext/jfxrt.jar && \
37+
rm -rf /opt/mcr/*/sys/java/jre/glnxa64/jre/lib/amd64/libjfxwebkit.so && \
38+
rm -rf /opt/mcr/*/bin/glnxa64/libQt* && \
39+
rm -rf /opt/mcr/*/bin/glnxa64/qtwebengine && \
40+
rm -rf /opt/mcr/*/bin/glnxa64/cef_resources && \
41+
{{/core_only}}
42+
rm -rf /opt/mcr_install /tmp/*
43+
44+
# Configure environment
45+
ENV MCR_VERSION {{ MCR_VERSION }}
46+
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
47+
ENV MCR_INHIBIT_CTF_LOCK 1
48+
ENV MCR_HOME /opt/mcr/${MCR_VERSION}

0 commit comments

Comments
 (0)