-
Notifications
You must be signed in to change notification settings - Fork 12
154 lines (154 loc) · 7.69 KB
/
dip-upload.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: "DIP Upload Test"
on:
workflow_dispatch:
inputs:
am_version:
description: "Archivematica ref (branch, tag or SHA to checkout)"
default: "qa/1.x"
required: true
type: "string"
ss_version:
description: "Archivematica Storage Service ref (branch, tag or SHA to checkout)"
default: "qa/0.x"
required: true
type: "string"
atom_version:
description: "AtoM ref (branch, tag or SHA to checkout)"
default: "qa/2.x"
required: true
type: "string"
schedule:
- cron: "0 2 * * *"
jobs:
test:
name: "DIP upload test"
runs-on: "ubuntu-24.04"
env:
am_version: "${{ inputs.am_version || 'qa/1.x' }}"
ss_version: "${{ inputs.ss_version || 'qa/0.x' }}"
atom_version: "${{ inputs.atom_version || 'qa/2.x' }}"
python_version: "3.10"
steps:
- name: "Uninstall MySQL"
run: |
sudo apt-get remove --purge "mysql*"
sudo rm -rf /var/lib/mysql* /etc/mysql
- name: "Check out the code"
uses: "actions/checkout@v4"
- name: "Install Python"
uses: "actions/setup-python@v5"
with:
python-version: "${{ env.python_version }}"
cache: "pip"
cache-dependency-path: |
tests/dip-upload/requirements.txt
- name: "Cache the virtual environment"
id: "venv-cache"
uses: "actions/cache@v4"
with:
path: |
tests/dip-upload/.venv/
key: "os-${{ runner.os }}-python_version-${{ env.python_version }}-hash-${{ hashFiles('tests/dip-upload/requirements.txt') }}"
- name: "Set up the virtual environment"
if: "steps.venv-cache.outputs.cache-hit == false"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
- name: "Add virtual environment to PATH"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run:
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: "Generate an SSH key and copy it next to the Dockerfile"
run: |
mkdir $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/id_rsa -N ""
cp $HOME/.ssh/id_rsa.pub ${{ github.workspace }}/tests/dip-upload/ssh_pub_key
- name: "Start the Compose environment"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
podman-compose up --detach
- name: "Install Archivematica"
working-directory: "${{ github.workspace }}/tests/dip-upload"
env:
ANSIBLE_HOST_KEY_CHECKING: "False"
ANSIBLE_REMOTE_PORT: 2222
run: |
ansible-galaxy install -f -p roles/ -r requirements.yml
ansible-playbook -i localhost, archivematica.yml \
-u ubuntu \
-e "archivematica_src_am_version=${{ env.am_version }} archivematica_src_ss_version=${{ env.ss_version }}" \
-v
- name: "Add the ubuntu user to the archivematica group"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
podman-compose exec --user root archivematica usermod -a -G archivematica ubuntu
- name: "Get the archivematica SSH public key"
id: archivematica_ssh_pub_key
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
echo "key=$(podman-compose exec --user archivematica archivematica cat /var/lib/archivematica/.ssh/id_rsa.pub)" >> $GITHUB_OUTPUT
- name: "Install AtoM"
working-directory: "${{ github.workspace }}/tests/dip-upload"
env:
ANSIBLE_HOST_KEY_CHECKING: "False"
ANSIBLE_REMOTE_PORT: 9222
run: |
ansible-playbook -i localhost, atom.yml \
-u ubuntu \
-e "atom_repository_version=${{ env.atom_version }} archivematica_ssh_pub_key='${{ steps.archivematica_ssh_pub_key.outputs.key }}'" \
-v
- name: "Call an Archivematica API endpoint"
run: |
curl \
--header "Authorization: ApiKey admin:this_is_the_am_api_key" \
http://localhost:8000/api/processing-configuration/
- name: "Call a Storage Service API endpoint"
run: |
curl \
--header "Authorization: ApiKey admin:this_is_the_ss_api_key" \
http://localhost:8001/api/v2/pipeline/
- name: "Call an AtoM API endpoint"
run: |
curl \
--header "REST-API-Key: this_is_the_atom_dip_upload_api_key" \
http://localhost:9000/index.php/api/informationobjects
- name: "Create a processing configuration for DIP upload"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
podman-compose exec --user archivematica archivematica cp /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/automatedProcessingMCP.xml /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml
- name: "Update the DIP upload processing configuration"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
# Change 'Normalize for preservation' to 'Normalize for preservation and access'
podman-compose exec --user archivematica archivematica sed --in-place 's|612e3609-ce9a-4df6-a9a3-63d634d2d934|b93cecd4-71f2-4e28-bc39-d32fd62c5a94|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml
# Change 'Do not upload DIP' to 'Upload DIP to AtoM/Binder'
podman-compose exec --user archivematica archivematica sed --in-place 's|6eb8ebe7-fab3-4e4c-b9d7-14de17625baa|0fe9842f-9519-4067-a691-8a363132ae24|g' /var/archivematica/sharedDirectory/sharedMicroServiceTasksConfigs/processingMCPConfigs/dipuploadProcessingMCP.xml
- name: "Import the Atom sample data"
working-directory: "${{ github.workspace }}/tests/dip-upload"
run: |
podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony csv:import /usr/share/nginx/atom/lib/task/import/example/isad/example_information_objects_isad.csv
podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony propel:build-nested-set
podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony cc
podman-compose exec --user www-data --workdir /usr/share/nginx/atom/ atom php -d memory_limit=-1 symfony search:populate
- name: "Start a transfer and upload the DIP to the sample archival description"
run: |
curl \
--header "Authorization: ApiKey admin:this_is_the_am_api_key" \
--request POST \
--data "{ \
\"name\": \"dip-upload-test\", \
\"path\": \"$(echo -n '/home/ubuntu/archivematica-sampledata/SampleTransfers/DemoTransferCSV' | base64 -w 0)\", \
\"type\": \"standard\", \
\"processing_config\": \"dipupload\", \
\"access_system_id\": \"example-item\" \
}" \
http://localhost:8000/api/v2beta/package
- name: "Wait for the transfer to finish"
run: |
sleep 120
- name: "Verify a digital object was uploaded and attached to the sample archival description"
run: |
curl \
--header "REST-API-Key: this_is_the_atom_dip_upload_api_key" \
http://localhost:9000/index.php/api/informationobjects/beihai-guanxi-china-1988 | python3 -m json.tool | grep '"parent": "example-item"'