Skip to content

Commit 973b962

Browse files
author
Andrea Barbasso
committed
Merged dspace-cris-2025_02_x into task/dspace-cris-2025_02_x/DSC-2668
2 parents ae626c1 + 6bd9f88 commit 973b962

File tree

120 files changed

+1611
-518
lines changed

Some content is hidden

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

120 files changed

+1611
-518
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ name: Build
77
on: [push, pull_request]
88

99
permissions:
10-
contents: read # to fetch code (actions/checkout)
11-
packages: read # to fetch private images from GitHub Container Registry (GHCR)
10+
contents: read # to fetch code (actions/checkout)
11+
packages: read # to fetch private images from GitHub Container Registry (GHCR)
1212

1313
jobs:
1414
tests:
@@ -19,7 +19,7 @@ jobs:
1919
# NOTE: These settings should be kept in sync with those in [src]/docker/docker-compose-ci.yml
2020
DSPACE_REST_HOST: 127.0.0.1
2121
DSPACE_REST_PORT: 8080
22-
DSPACE_REST_NAMESPACE: '/server'
22+
DSPACE_REST_NAMESPACE: "/server"
2323
DSPACE_REST_SSL: false
2424
# Spin up UI on 127.0.0.1 to avoid host resolution issues in e2e tests with Node 20+
2525
DSPACE_UI_HOST: 127.0.0.1
@@ -35,9 +35,9 @@ jobs:
3535
# Comment this out to use the latest release
3636
#CHROME_VERSION: "116.0.5845.187-1"
3737
# Bump Node heap size (OOM in CI after upgrading to Angular 15)
38-
NODE_OPTIONS: '--max-old-space-size=4096'
38+
NODE_OPTIONS: "--max-old-space-size=4096"
3939
# Project name to use when running "docker compose" prior to e2e tests
40-
COMPOSE_PROJECT_NAME: 'ci'
40+
COMPOSE_PROJECT_NAME: "ci"
4141
# Docker Registry to use for Docker compose scripts below.
4242
# We use GitHub's Container Registry to avoid aggressive rate limits at DockerHub.
4343
DOCKER_REGISTRY: ghcr.io
@@ -117,7 +117,7 @@ jobs:
117117
if: matrix.node-version == '20.x'
118118
with:
119119
name: coverage-report-${{ matrix.node-version }}
120-
path: 'coverage/dspace-angular/lcov.info'
120+
path: "coverage/dspace-angular/lcov.info"
121121
retention-days: 14
122122

123123
# Login to our Docker registry, so that we can access private Docker images using "docker compose" below.
@@ -142,6 +142,7 @@ jobs:
142142
- name: Run e2e tests (integration tests)
143143
uses: cypress-io/github-action@v6
144144
with:
145+
install-command: npm ci
145146
# Run tests in Chrome, headless mode (default)
146147
browser: chrome
147148
# Start app before running tests (will be stopped automatically after tests finish)
@@ -234,9 +235,9 @@ jobs:
234235
# the name of the project. If it does, then SSR is working.
235236
- name: Verify SSR on a Project page
236237
run: |
237-
result=$(wget -O- -q http://127.0.0.1:4000/entities/project/1e3451e4-60d7-46a8-962e-5b94b62c63ff)
238+
result=$(wget -O- -q http://127.0.0.1:4000/entities/project/28f8f49a-1aaf-4acc-93a9-203f3cf7ba62)
238239
echo "$result"
239-
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Test DSC-1819"
240+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "TEST PROJECT"
240241
241242
# Get a specific orgunit in our test data and verify that the <meta name="title"> tag includes
242243
# the name of the orgunit. If it does, then SSR is working.
@@ -262,7 +263,6 @@ jobs:
262263
echo "$result"
263264
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "test funding"
264265
265-
266266
# Verify 301 Handle redirect behavior
267267
# Note: /handle/123456789/260 is the same test Publication used by our e2e tests
268268
- name: Verify 301 redirect from '/handle' URLs

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ ENV NODE_OPTIONS="--max_old_space_size=4096"
2121
# NOTE: At this time it is only possible to run Docker container in Production mode
2222
# if you have a public URL. See https://github.com/DSpace/dspace-angular/issues/1485
2323
ENV NODE_ENV=development
24+
ENV CI=true
25+
ENV NO_COLOR=1
2426
CMD npm run serve -- --host 0.0.0.0

Dockerfile.dependencies

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ ARG DOCKER_REGISTRY=docker.io
99
FROM docker.io/node:${NODE_VERSION-22}-alpine AS dependencies
1010

1111
# Install build dependencies
12-
RUN apk add --no-cache python3 make g++
12+
# RUN apk add --no-cache python3 make g++
1313

1414
WORKDIR /app
1515

1616
# Install dependencies (use npm ci if you have package-lock.json)
17-
COPY package.json yarn.lock ./
18-
RUN yarn install --frozen-lockfile --network-timeout 300000
17+
COPY package*.json ./
18+
19+
RUN --mount=type=cache,target=/root/.npm \
20+
npm ci

Dockerfile.dist

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ COPY . /app/
1818
WORKDIR /app
1919

2020
# Build Angular app
21-
RUN npm run build:prod
22-
RUN npm run build:mirador
21+
RUN --mount=type=cache,target=/root/.npm \
22+
npm run build:prod
23+
RUN --mount=type=cache,target=/root/.npm \
24+
npm run build:mirador
2325

2426
# ---- Production image ----
2527
FROM docker.io/node:${NODE_VERSION-22}-alpine AS prod
2628

2729
# Install pm2 globally and clean npm cache
28-
RUN npm install --global pm2 && npm cache clean --force
30+
RUN --mount=type=cache,target=/root/.npm \
31+
npm install --global pm2 && npm cache clean --force
2932

3033
WORKDIR /app
3134

bitbucket-pipelines.yml

Lines changed: 73 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ definitions:
215215
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
216216
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
217217
- cd dspace-values
218-
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "test/${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "test/${BRANCH_FILE}"'
218+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" */test/"${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" */test/"${BRANCH_FILE}"'
219219
- git config --global user.email "${BB_EMAIL}"
220220
- git config --global user.name "${BB_USER}"
221221
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
@@ -260,44 +260,65 @@ definitions:
260260
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
261261
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
262262
- cd dspace-values
263-
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
263+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
264264
- git config --global user.email "${BB_USER}"
265265
- git config --global user.name "${BB_EMAIL}"
266266
- git commit -am "Enable test environment for ${BRANCH_NAME}" || echo "No changes to commit"
267267
- git push
268268

269-
- step: &find-and-invalidate-cloudfront-dev
270-
name: Invalidate CloudFront Dev Cache
269+
- step: &find-cloudfront-dev
270+
name: Find CloudFront Dev Cache
271271
image: amazon/aws-cli
272272
script:
273273
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
274274
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
275275
- export AWS_DEFAULT_REGION=$AWS_REGION
276276
- export CLOUDFRONT_NAME=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
277277
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='dev--${CLOUDFRONT_NAME}'].Id" --output text)
278-
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
278+
- echo "cloudfront_distribution=$CLOUDFRONT_DISTRIBUTION_ID" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
279+
output-variables:
280+
- cloudfront_distribution
279281

280-
- step: &find-and-invalidate-cloudfront-staging
281-
name: Invalidate CloudFront Staging Cache
282+
- step: &find-cloudfront-staging
283+
name: Find CloudFront Staging Cache
282284
image: amazon/aws-cli
283285
script:
284286
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
285287
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
286288
- export AWS_DEFAULT_REGION=$AWS_REGION
287289
- export CLOUDFRONT_NAME=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
288290
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='staging--${CLOUDFRONT_NAME}'].Id" --output text)
289-
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
291+
- echo "cloudfront_distribution=$CLOUDFRONT_DISTRIBUTION_ID" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
292+
output-variables:
293+
- cloudfront_distribution
290294

291-
- step: &find-and-invalidate-cloudfront-test
292-
name: Invalidate CloudFront Test Cache
295+
- step: &invalidate-cloudfront
296+
name: Invalidate CloudFront Cache
297+
image: amazon/aws-cli
298+
condition:
299+
state: cloudfront_distribution != ""
300+
script:
301+
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
302+
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
303+
- export AWS_DEFAULT_REGION=$AWS_REGION
304+
- |
305+
if ! aws cloudfront create-invalidation --distribution-id $cloudfront_distribution --paths "/*"; then
306+
echo "CloudFront invalidation failed for distribution ID: $cloudfront_distribution"
307+
exit 1
308+
fi
309+
310+
- step: &find-cloudfront-test
311+
name: Find CloudFront Test Cache
293312
image: amazon/aws-cli
294313
script:
295314
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
296315
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
297316
- export AWS_DEFAULT_REGION=$AWS_REGION
298317
- export CLOUDFRONT_NAME=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
299318
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='test--${CLOUDFRONT_NAME}'].Id" --output text)
300-
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
319+
- echo "cloudfront_distribution=$CLOUDFRONT_DISTRIBUTION_ID" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
320+
output-variables:
321+
- cloudfront_distribution
301322

302323
- step: &check-branch-name-allowed
303324
name: Check allowed branch name
@@ -311,6 +332,23 @@ definitions:
311332
exit 1
312333
fi
313334
335+
- step: &merge-prod-into-test
336+
name: Merge prod into test
337+
image: atlassian/default-image:4
338+
script:
339+
- export PROD_BRANCH="$BITBUCKET_BRANCH"
340+
- export TEST_BRANCH="test/${PROD_BRANCH#prod/}"
341+
- git fetch origin $TEST_BRANCH || true
342+
- if git ls-remote --exit-code --heads origin $TEST_BRANCH; then
343+
git remote set-branches --add origin $TEST_BRANCH;
344+
git fetch origin $TEST_BRANCH;
345+
git checkout -b $TEST_BRANCH origin/$TEST_BRANCH;
346+
git merge --no-ff origin/$PROD_BRANCH -m "Merge $PROD_BRANCH into $TEST_BRANCH";
347+
git push https://${DSPACE_REPO_USER}:${DSPACE_REPO_TOKEN}@${DSPACE_ANGULAR_REPO} $TEST_BRANCH;
348+
else
349+
echo "Branch $TEST_BRANCH does not exist, no merge performed.";
350+
fi
351+
314352
pipelines:
315353
custom:
316354
e2e-on-custom-backend:
@@ -323,13 +361,22 @@ pipelines:
323361
- step: *angular-build
324362
- step: *build-and-push
325363
- step: *deploy-on-dev
326-
- step: *find-and-invalidate-cloudfront-dev
364+
- step: *find-cloudfront-dev
365+
- step: *invalidate-cloudfront
327366
deploy-on-staging:
328367
- step: *check-branch-name-allowed
329368
- step: *angular-build
330369
- step: *build-and-push
331370
- step: *deploy-on-staging
332-
- step: *find-and-invalidate-cloudfront-staging
371+
- step: *find-cloudfront-staging
372+
- step: *invalidate-cloudfront
373+
deploy-on-test:
374+
- step: *check-branch-name-allowed
375+
- step: *angular-build
376+
- step: *build-and-push
377+
- step: *deploy-on-test
378+
- step: *find-cloudfront-test
379+
- step: *invalidate-cloudfront
333380
turn-on-dev:
334381
- step: *turn-on-dev
335382
turn-on-staging:
@@ -349,27 +396,33 @@ pipelines:
349396
- parallel: *parallel-run-tests
350397
- step: *build-and-push
351398
- step: *deploy-on-dev
352-
- step: *find-and-invalidate-cloudfront-dev
399+
- step: *find-cloudfront-dev
400+
- step: *invalidate-cloudfront
353401
- step: *deploy-on-staging
354-
- step: *find-and-invalidate-cloudfront-staging
355-
'prod/**':
402+
- step: *find-cloudfront-staging
403+
- step: *invalidate-cloudfront
404+
"prod/**":
356405
- step: *check-branch-name-allowed
357406
- step: *preliminary-operation
358407
- step: *angular-build
359408
- parallel: *parallel-run-tests
360409
- step: *build-and-push
361410
- step: *deploy-on-dev
362-
- step: *find-and-invalidate-cloudfront-dev
411+
- step: *find-cloudfront-dev
412+
- step: *invalidate-cloudfront
363413
- step: *deploy-on-staging
364-
- step: *find-and-invalidate-cloudfront-staging
365-
'test/**':
414+
- step: *find-cloudfront-staging
415+
- step: *invalidate-cloudfront
416+
- step: *merge-prod-into-test
417+
"test/**":
366418
- step: *check-branch-name-allowed
367419
- step: *preliminary-operation
368420
- step: *angular-build
369421
- parallel: *parallel-run-tests
370422
- step: *build-and-push
371423
- step: *deploy-on-test
372-
- step: *find-and-invalidate-cloudfront-test
424+
- step: *find-cloudfront-test
425+
- step: *invalidate-cloudfront
373426

374427
pull-requests:
375428
'**':

cypress/e2e/admin-search-page.cy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { testA11y } from 'cypress/support/utils';
22

3-
// TODO: Enable these tests and fix them before the release
4-
xdescribe('Admin Search Page', () => {
3+
describe('Admin Search Page', () => {
54
beforeEach(() => {
65
// Must login as an Admin to see the page
76
cy.visit('/admin/search');

cypress/e2e/admin-workflow-page.cy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { testA11y } from 'cypress/support/utils';
22

3-
// TODO: Enable these tests and fix them before the release
4-
xdescribe('Admin Workflow Page', () => {
3+
describe('Admin Workflow Page', () => {
54
beforeEach(() => {
65
// Must login as an Admin to see the page
76
cy.visit('/admin/workflow');

cypress/e2e/bulk-access.cy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { testA11y } from 'cypress/support/utils';
22
import { Options } from 'cypress-axe';
33

4-
// TODO: Enable these tests and fix them before the release
5-
xdescribe('Bulk Access', () => {
4+
describe('Bulk Access', () => {
65
beforeEach(() => {
76
// Must login as an Admin to see the page
87
cy.visit('/access-control/bulk-access');

cypress/e2e/homepage-statistics.cy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import '../support/commands';
33
import { REGEX_MATCH_NON_EMPTY_TEXT } from 'cypress/support/e2e';
44
import { testA11y } from 'cypress/support/utils';
55

6-
// TODO: Enable these tests and fix them before the release
7-
xdescribe('Site Statistics Page', () => {
6+
describe('Site Statistics Page', () => {
87
it('should load if you click on "Statistics" from homepage', () => {
98
cy.visit('/');
109
cy.get('#expandable-navbar-section-statistics > [data-test="navbar-section-toggler"]').trigger('keyup', { key: 'Enter' });

cypress/e2e/homepage.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { testA11y } from 'cypress/support/utils';
22
import { Options } from 'cypress-axe';
33

44
// TODO: Enable these tests and fix them before the release
5-
xdescribe('Homepage', () => {
5+
describe('Homepage', () => {
66
beforeEach(() => {
77
// All tests start with visiting homepage
88
cy.visit('/');

0 commit comments

Comments
 (0)