Skip to content

Commit bbe0559

Browse files
authored
πŸ§‘β€πŸ’» Scripts to deprecate already-published Docker images (#6)
2 parents 3daa100 + b8d41a9 commit bbe0559

11 files changed

Lines changed: 267 additions & 0 deletions

β€Ž.gitignoreβ€Ž

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) 2022 C-PAC Developers
3+
#
4+
# This file is part of CPAC-Development.
5+
#
6+
# CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
7+
#
8+
# CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
9+
#
10+
# You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
11+
12+
# Files that should be updated fresh each time
13+
deprecate/cpac_pipeline.py
14+
deprecate/run.py

β€ŽREADME.mdβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1+
<!-- Copyright (C) 2022 C-PAC Developers
2+
3+
This file is part of CPAC-Development.
4+
5+
CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6+
7+
CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
8+
9+
You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>. -->
110
CPAC-Development
211
================

β€Ždeprecate/CRITICAL_ALERT.rstβ€Ž

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. Copyright (C) 2022 C-PAC Developers
2+
..
3+
.. This file is part of CPAC-Development.
4+
..
5+
.. CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6+
..
7+
.. CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
8+
..
9+
.. You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
10+
11+
This version of C-PAC (``${DEPRECATED_VERSION}``) is deprecated due to a bug in ``single_step_resampling``. Unless you have a specific reason to use this version of C-PAC (``${DEPRECATED_VERSION}``), we recommend upgrading to at least version ${RECOMMENDED_MINIMUM_VERSION}. See https://fcp-indi.github.io/docs/latest/user/release_notes/v${RECOMMENDED_MINIMUM_VERSION} for more information about C-PAC v${RECOMMENDED_MINIMUM_VERSION}. To use ${DEPRECATED_VERSION} anyway, you can pull ``fcpindi/c-pac:${DEPRECATED_VERSION}-DEPRECATED`` from Docker Hub.
12+
13+
Critical Alert for fMRIPrep-Options in C-PAC v1.8.1 - v1.8.3
14+
============================================================
15+
16+
* Fixed a bug that was causing ``single_step_resampling``, when combined with certain other configurations, to inadvertently cause unexpected forks in the pipeline past transform application.
17+
18+
* This bug caused any affected ``fmriprep-options-based`` pipeline configurations (including ``fx-options`` and ``rbc-options``) to produce BOLD time series write-outs to the output directory in template space which were not nuisance regressed or filtered, for C-PAC versions 1.8.1 through 1.8.3.
19+
20+
* Although these outputs were not expressly labeled as nuisance regressed or filtered, they were labeled as preprocessed with ``desc-preproc`` and were the only functional data transformed to template space and used for downstream processing, such as ROI-based timeseries extraction.
21+
22+
* If you are unsure if you have been affected, you can check the side-car JSON for your template-space BOLD data from these versions for those pipeline configurations, as the JSON will still accurately reflect what operations had been performed on the data.
23+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2022 C-PAC Developers
2+
3+
# This file is part of CPAC-Development.
4+
5+
# CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6+
7+
# CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
8+
9+
# You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
10+
ARG DEPRECATED_VERSION
11+
ARG RECOMMENDED_MINIMUM_VERSION
12+
FROM bash
13+
ARG DEPRECATED_VERSION
14+
ARG RECOMMENDED_MINIMUM_VERSION
15+
COPY ./CRITICAL_ALERT.rst /CRITICAL_ALERT.rst
16+
COPY ./entrypoint /entrypoint
17+
RUN sed -i "s|\${DEPRECATED_VERSION}|${DEPRECATED_VERSION}|g" /CRITICAL_ALERT.rst && \
18+
sed -i "s|\${RECOMMENDED_MINIMUM_VERSION}|${RECOMMENDED_MINIMUM_VERSION}|g" /CRITICAL_ALERT.rst && \
19+
ln -s /entrypoint /bin/bash
20+
ENTRYPOINT [ "/entrypoint" ]

β€Ždeprecate/Dockerfileβ€Ž

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (C) 2022 C-PAC Developers
2+
#
3+
# This file is part of CPAC-Development.
4+
#
5+
# CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6+
#
7+
# CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
8+
#
9+
# You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
10+
ARG DEPRECATED_VERSION
11+
FROM fcpindi/c-pac:${DEPRECATED_VERSION}
12+
ARG DEPRECATED_VERSION
13+
COPY ./CRITICAL_ALERT.rst /CRITICAL_ALERT.rst
14+
COPY ./bash.bashrc /etc/bash.bashrc
15+
RUN sed -i "s|\${DEPRECATED_VERSION}|${DEPRECATED_VERSION}|g" /CRITICAL_ALERT.rst && \
16+
sed -i "s|\${RECOMMENDED_MINIMUM_VERSION}|${RECOMMENDED_MINIMUM_VERSION}|g" /CRITICAL_ALERT.rst
17+
COPY ./cpac_pipeline.py /code/CPAC/pipeline/cpac_pipeline.py
18+
COPY ./run.py /code/run.py

β€Ždeprecate/README.mdβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- Copyright (C) 2022 C-PAC Developers
2+
3+
This file is part of CPAC-Development.
4+
5+
CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
6+
7+
CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
8+
9+
You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>. -->
10+
C-PAC version deprecation scripts
11+
=================================
12+
13+
In the rare occasion a version of C-PAC that exists on Docker Hub needs to be deprecated, the files in this directory can facilitate the process.
14+
15+
See https://fcp-indi.github.io/docs/nightly/developer/deprecating and the individual executable scripts for more information.
16+

β€Ždeprecate/bash.bashrcβ€Ž

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# System-wide .bashrc file for interactive bash(1) shells.
2+
3+
# Bash is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
4+
5+
# To enable the settings / commands in this file for login shells as well,
6+
# this file has to be sourced in /etc/profile.
7+
8+
# If not running interactively, don't do anything
9+
[ -z "$PS1" ] && return
10+
11+
# check the window size after each command and, if necessary,
12+
# update the values of LINES and COLUMNS.
13+
shopt -s checkwinsize
14+
15+
# set variable identifying the chroot you work in (used in the prompt below)
16+
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
17+
debian_chroot=$(cat /etc/debian_chroot)
18+
fi
19+
20+
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
21+
# but only if not SUDOing and have SUDO_PS1 set; then assume smart user.
22+
if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then
23+
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
24+
fi
25+
26+
# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
27+
# If this is an xterm set the title to user@host:dir
28+
#case "$TERM" in
29+
#xterm*|rxvt*)
30+
# PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
31+
# ;;
32+
#*)
33+
# ;;
34+
#esac
35+
36+
# enable bash completion in interactive shells
37+
#if ! shopt -oq posix; then
38+
# if [ -f /usr/share/bash-completion/bash_completion ]; then
39+
# . /usr/share/bash-completion/bash_completion
40+
# elif [ -f /etc/bash_completion ]; then
41+
# . /etc/bash_completion
42+
# fi
43+
#fi
44+
45+
# sudo hint
46+
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
47+
case " $(groups) " in *\ admin\ *|*\ sudo\ *)
48+
if [ -x /usr/bin/sudo ]; then
49+
cat <<-EOF
50+
To run a command as administrator (user "root"), use "sudo <command>".
51+
See "man sudo_root" for details.
52+
53+
EOF
54+
fi
55+
esac
56+
fi
57+
58+
# if the command-not-found package is installed, use it
59+
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
60+
function command_not_found_handle {
61+
# check because c-n-f could've been removed in the meantime
62+
if [ -x /usr/lib/command-not-found ]; then
63+
/usr/lib/command-not-found -- "$1"
64+
return $?
65+
elif [ -x /usr/share/command-not-found/command-not-found ]; then
66+
/usr/share/command-not-found/command-not-found -- "$1"
67+
return $?
68+
else
69+
printf "%s: command not found\n" "$1" >&2
70+
return 127
71+
fi
72+
}
73+
fi
74+
75+
# Display CRITICAL ALERT on launch
76+
grep -v '^\.\. ' /CRITICAL_ALERT.rst
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This script takes a tag ($TAG) from https://hub.docker.com/repository/docker/fcpindi/c-pac/tags, and does the following:
2+
# 1. creates an image tagged ${TAG}-DEPRECATED with the same contents as the given tag except also printing the text in `CRITICAL_ALERT.rst` when the image is run and adding a copy to the log directory of each run generated by the image,
3+
# 2. replaces that tag with an image that only prints the text in `CRITICAL_ALERT.rst`, and
4+
# 3. pushes both images to Docker Hub, overwriting any existing images with the same name.
5+
#
6+
# Usage: ./build_and_deprecate $DEPRECATED_TAG $RECOMMENDED_MINIMUM_VERSION
7+
# See https://fcp-indi.github.io/docs/developer/deprecating for more information
8+
#
9+
# Copyright (C) 2022 C-PAC Developers
10+
11+
# This file is part of CPAC-Development.
12+
13+
# CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
14+
15+
# CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16+
17+
# You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
18+
19+
if [[ $# != 2 ]]
20+
then
21+
head -n 7 $(basename "$0")
22+
exit 0
23+
fi
24+
25+
export DEPRECATED_TAG=$1
26+
export RECOMMENDED_MINIMUM_VERSION=$2
27+
docker pull fcpindi/c-pac:${DEPRECATED_TAG}
28+
docker build -t fcpindi/c-pac:${DEPRECATED_TAG}-DEPRECATED --build-arg DEPRECATED_VERSION=${DEPRECATED_TAG} --build-arg RECOMMENDED_MINIMUM_VERSION=${RECOMMENDED_MINIMUM_VERSION} .
29+
docker build -t fcpindi/c-pac:${DEPRECATED_TAG} -f DEPRECATED.Dockerfile --build-arg DEPRECATED_VERSION=${DEPRECATED_TAG} --build-arg RECOMMENDED_MINIMUM_VERSION=${RECOMMENDED_MINIMUM_VERSION} .
30+
docker push fcpindi/c-pac:${DEPRECATED_TAG}-DEPRECATED
31+
docker push fcpindi/c-pac:${DEPRECATED_TAG}

β€Ždeprecate/entrypointβ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) 2022 C-PAC Developers
3+
#
4+
# This file is part of CPAC-Development.
5+
#
6+
# CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
7+
#
8+
# CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
9+
#
10+
# You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
11+
grep -v '^\.\. ' /CRITICAL_ALERT.rst
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This script takes a tag ($TAG) from https://hub.docker.com/repository/docker/fcpindi/c-pac/tags, and does the following:
2+
# 1. recreates an image with the same contents as ${TAG}-DEPRECATED except also printing the text in `CRITICAL_ALERT.rst` when the image is run and adding a copy to the log directory of each run generated by the image,
3+
# 2. replaces that tag with an image that only prints the text in `CRITICAL_ALERT.rst`, and
4+
# 3. pushes both images to Docker Hub, overwriting any existing images with the same name.
5+
#
6+
# Usage: ./rebuild_and_deprecate $DEPRECATED_TAG $RECOMMENDED_MINIMUM_VERSION
7+
# See https://fcp-indi.github.io/docs/developer/deprecating for more information
8+
#
9+
# Copyright (C) 2022 C-PAC Developers
10+
11+
# This file is part of CPAC-Development.
12+
13+
# CPAC-Development is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
14+
15+
# CPAC-Development is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16+
17+
# You should have received a copy of the GNU Lesser General Public License along with CPAC-Development. If not, see <https://www.gnu.org/licenses/>.
18+
19+
if [[ $# != 2 ]]
20+
then
21+
head -n 7 $(basename "$0")
22+
exit 0
23+
fi
24+
25+
export DEPRECATED_TAG=$1
26+
export RECOMMENDED_MINIMUM_VERSION=$2
27+
docker pull fcpindi/c-pac:${DEPRECATED_TAG}-DEPRECATED
28+
docker build -t fcpindi/c-pac:${DEPRECATED_TAG}-DEPRECATED --build-arg DEPRECATED_VERSION=${DEPRECATED_TAG} --build-arg RECOMMENDED_MINIMUM_VERSION=${RECOMMENDED_MINIMUM_VERSION} -f redeprecate.Dockerfile .
29+
docker build -t fcpindi/c-pac:${DEPRECATED_TAG} -f DEPRECATED.Dockerfile --build-arg DEPRECATED_VERSION=${DEPRECATED_TAG} --build-arg RECOMMENDED_MINIMUM_VERSION=${RECOMMENDED_MINIMUM_VERSION} .
30+
docker push fcpindi/c-pac:${DEPRECATED_TAG}-DEPRECATED
31+
docker push fcpindi/c-pac:${DEPRECATED_TAG}

0 commit comments

Comments
Β (0)