Skip to content

Commit 51b7697

Browse files
authored
fixing bug with listing and container_image (#170)
* fixing bug with listing and container_image currently, the listing parser expects there to be a container_image key in the result, but I just found a case where it is not there. I am making it option by using .get( instead of a direct index * require singularity 3.x or greater for singularity instance list with json * remove black version pin * I dont think we need instance.iutils anymore, I dont see it being used and its redundant with list * test updated singularity orb version * test if circleci config is valid Signed-off-by: vsoch <[email protected]> Co-authored-by: vsoch <[email protected]>
1 parent 4542532 commit 51b7697

File tree

185 files changed

+6199
-1797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+6199
-1797
lines changed

.circleci/config.yml

Lines changed: 79 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,118 @@
1-
# CircleCI build config to test different versions of Singuarity
21
version: 2.1
32

4-
orbs:
5-
singularity: singularity/[email protected]
3+
# Modified from hpcng/singularity
64

75
workflows:
86
version: 2
9-
test:
7+
build_and_test:
108
jobs:
11-
- run-spython-ci-tests: &base_job
9+
- test_singularity_python:
1210
filters:
1311
branches:
1412
ignore: master
15-
name: "Latest Singularity - Python 3"
16-
run-linter: false
17-
singularity: 3.5.0
18-
singularity-3: true
19-
- run-spython-ci-tests:
20-
<<: *base_job
21-
name: "Singularity 3.2.1 - Python 3"
22-
singularity: 3.2.1
23-
run-linter: true # run linter once, must be Python 3
24-
- run-spython-ci-tests:
25-
<<: *base_job
26-
name: "Singularity 3.1.0 - Python 3"
27-
singularity: 3.1.0
28-
- run-spython-ci-tests:
29-
<<: *base_job
30-
name: "Singularity 2 - Python 3"
31-
singularity: 2.6.1
32-
singularity-3: false
3313

34-
waitforapt: &waitforapt
35-
name: Remove cloud init lock
36-
command: |
37-
while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 10; done
38-
while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1; do echo 'Waiting for autoupdates to complete...'; sleep 10; done
39-
echo 'Waiting for instance to really be ready...'
40-
sleep 30
41-
sudo rm -rf /var/lib/apt/lists/lock
42-
sudo rm /var/lib/dpkg/lock && sudo dpkg --configure -a
14+
setup_environment: &setup_environment
15+
name: Setup environment
16+
command: |-
17+
echo 'set -x' >> $BASH_ENV
18+
echo 'export GOPATH=$HOME/go' >> $BASH_ENV
19+
echo 'export GOROOT=/usr/local/go' >> $BASH_ENV
20+
echo 'export GOBIN=$HOME/go/bin' >> $BASH_ENV
21+
echo 'export PATH=$GOBIN:$GOROOT/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin' >> $BASH_ENV
22+
env | sed -e 's,^,ENV: ,' | sort
23+
test -e $BASH_ENV && sed -e 's,^,BASH_ENV: ,' < $BASH_ENV
4324
25+
update_go: &update_go
26+
name: Update Go to 1.14.9
27+
working_directory: /tmp
28+
command: |-
29+
wget https://dl.google.com/go/go1.14.9.linux-amd64.tar.gz
30+
sudo rm -rf $GOROOT
31+
sudo tar -C /usr/local -xzf go1.14.9.linux-amd64.tar.gz
32+
sudo ln -s $GOROOT/bin/go /usr/local/bin/go
4433
34+
fetch_deb_deps: &fetch_deb_deps
35+
name: Fetch deps
36+
working_directory: /tmp
37+
command: |-
38+
# https://discuss.circleci.com/t/could-not-get-lock-var-lib-apt-lists-lock/28337/4
39+
sudo killall -9 apt-get || true && \
40+
sudo apt-get update -y && \
41+
sudo apt-get install -y build-essential squashfs-tools libseccomp-dev cryptsetup
42+
43+
build_singularity: &install_singularity
44+
name: Build Singularity
45+
working_directory: ~/go/singularity
46+
command: |-
47+
cd ~/go
48+
wget https://github.com/hpcng/singularity/releases/download/v3.7.1/singularity-3.7.1.tar.gz && \
49+
tar -xzvf singularity-3.7.1.tar.gz && \
50+
cd singularity
51+
./mconfig -p /usr/local && \
52+
make -C builddir && \
53+
sudo make -C builddir install
54+
4555
install_spython: &install_spython
4656
name: install spython
47-
command: |
57+
command: |-
58+
export PATH=~/conda/Python3/bin:$PATH
59+
which python
4860
pip uninstall spython --yes || echo "Not installed"
4961
python --version
5062
python setup.py install
5163
52-
commands:
53-
install_dependencies:
54-
steps:
55-
- run: |
56-
PYTHON_VERSION=3
57-
CONDA_PATH="$HOME/conda/Python${PYTHON_VERSION}"
58-
echo 'export PATH="'"$CONDA_PATH"'/bin:$PATH"' >> "$BASH_ENV"
59-
source "$BASH_ENV"
60-
if [ ! -d "$CONDA_PATH" ]; then
61-
CONDA_SCRIPT=Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh
62-
wget https://repo.anaconda.com/miniconda/$CONDA_SCRIPT
63-
/bin/bash $CONDA_SCRIPT -b -p $CONDA_PATH
64-
else
65-
echo "Miniconda is already installed, continuing to build."
66-
fi
67-
python --version
68-
[ $(python -c'import sys;print(sys.version_info.major)') -eq $PYTHON_VERSION ]
64+
install_dependencies: &install_dependencies
65+
name: install dependencies
66+
command: |-
67+
PYTHON_VERSION=3
68+
CONDA_PATH="$HOME/conda/Python${PYTHON_VERSION}"
69+
echo 'export PATH="'"$CONDA_PATH"'/bin:$PATH"' >> "$BASH_ENV"
70+
source "$BASH_ENV"
71+
if [ ! -d "$CONDA_PATH" ]; then
72+
CONDA_SCRIPT=Miniconda${PYTHON_VERSION}-latest-Linux-x86_64.sh
73+
wget https://repo.anaconda.com/miniconda/$CONDA_SCRIPT
74+
/bin/bash $CONDA_SCRIPT -b -p $CONDA_PATH
75+
else
76+
echo "Miniconda is already installed, continuing to build."
77+
fi
78+
python --version
79+
[ $(python -c'import sys;print(sys.version_info.major)') -eq $PYTHON_VERSION ]
6980
70-
pip install --upgrade pytest
71-
pip install black || true
81+
pip install --upgrade pytest
82+
pip install black || true
7283
7384
run_linter: &run_linter
7485
name: run linter
75-
command: |
86+
command: |-
87+
export PATH=~/conda/Python3/bin:$PATH
7688
cd ~/repo
7789
black --check spython
7890
7991
test_spython: &test_spython
8092
name: Test Singularity Python
81-
command: pytest ~/repo/spython
93+
command: |-
94+
export PATH=~/conda/Python3/bin:$PATH
95+
pytest ~/repo/spython
96+
8297
8398
jobs:
84-
run-spython-ci-tests:
85-
parameters:
86-
run-linter:
87-
type: boolean
88-
default: false
89-
singularity:
90-
type: string
91-
description: "Singularity version"
92-
singularity-3:
93-
type: boolean
94-
description: "Set to true for singularity 3, false for singularity 2"
95-
default: true
96-
machine: true
99+
test_singularity_python:
97100
working_directory: ~/repo
101+
machine:
102+
image: ubuntu-2004:202008-01
98103
steps:
99104
- checkout
100105
- restore_cache:
101106
keys: v2-dependencies
102-
- install_dependencies
103-
- run: *waitforapt
104-
- when:
105-
condition: << parameters.singularity-3 >>
106-
steps:
107-
- singularity/install-go:
108-
go-version: "1.13"
109-
- singularity/debian-install-3:
110-
singularity-version: << parameters.singularity >>
111-
- unless:
112-
condition: << parameters.singularity-3 >>
113-
steps:
114-
- singularity/debian-install-2:
115-
singularity-version: << parameters.singularity >>
107+
- run: *install_dependencies
108+
- run: *setup_environment
109+
- run: *update_go
110+
- run: *fetch_deb_deps
111+
- run: *install_singularity
116112
- run: *install_spython
117113
- save_cache:
118114
paths:
119115
- ~/conda
120-
key: v2-dependencies
121-
- when:
122-
condition: << parameters.run-linter >>
123-
steps:
124-
- run: *run_linter
116+
key: v3-dependencies
117+
- run: *run_linter
125118
- run: *test_spython

0 commit comments

Comments
 (0)