Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue-9317
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Mahnke committed May 24, 2024
2 parents c0b18cd + 4802307 commit e6c24ae
Show file tree
Hide file tree
Showing 214 changed files with 4,190 additions and 1,750 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

# https://github.com/actions/setup-java
- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
Expand All @@ -65,14 +65,14 @@ jobs:
# (This artifact is downloadable at the bottom of any job's summary page)
- name: Upload Results of ${{ matrix.type }} to Artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.type }} results
path: ${{ matrix.resultsdir }}

# Upload code coverage report to artifact, so that it can be shared with the 'codecov' job (see below)
- name: Upload code coverage report to Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.type }} coverage report
path: 'dspace/target/site/jacoco-aggregate/jacoco.xml'
Expand All @@ -91,7 +91,7 @@ jobs:

# Download artifacts from previous 'tests' job
- name: Download coverage artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

# Now attempt upload to Codecov using its action.
# NOTE: We use a retry action to retry the Codecov upload if it fails the first time.
Expand All @@ -101,10 +101,11 @@ jobs:
- name: Upload coverage to Codecov.io
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3
action: codecov/codecov-action@v4
# Ensure codecov-action throws an error when it fails to upload
with: |
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# Try re-running action 5 times max
attempt_limit: 5
# Run again in 30 seconds
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codescan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

# https://github.com/actions/setup-java
- name: Install JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
needs: dspace-dependencies
uses: ./.github/workflows/reusable-docker-build.yml
with:
build_id: dspace
build_id: dspace-prod
image_name: dspace/dspace
dockerfile_path: ./Dockerfile
secrets:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
if: github.repository == 'dspace/dspace'
uses: ./.github/workflows/reusable-docker-build.yml
with:
build_id: dspace-postgres-pgcrypto
build_id: dspace-postgres-pgcrypto-prod
image_name: dspace/dspace-postgres-pgcrypto
# Must build out of subdirectory to have access to install script for pgcrypto.
# NOTE: this context will build the image based on the Dockerfile in the specified directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue_opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# Only add to project board if issue is flagged as "needs triage" or has no labels
# NOTE: By default we flag new issues as "needs triage" in our issue template
if: (contains(github.event.issue.labels.*.name, 'needs triage') || join(github.event.issue.labels.*.name) == '')
uses: actions/add-to-project@v0.5.0
uses: actions/add-to-project@v1.0.0
# Note, the authentication token below is an ORG level Secret.
# It must be created/recreated manually via a personal access token with admin:org, project, public_repo permissions
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
# Assign the PR to whomever created it. This is useful for visualizing assignments on project boards
# See https://github.com/toshimaru/auto-author-assign
- name: Assign PR to creator
uses: toshimaru/auto-author-assign@v2.0.1
uses: toshimaru/auto-author-assign@v2.1.0
26 changes: 18 additions & 8 deletions .github/workflows/reusable-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ env:
# See "Redeploy" steps below for more details.
REDEPLOY_SANDBOX_URL: ${{ secrets.REDEPLOY_SANDBOX_URL }}
REDEPLOY_DEMO_URL: ${{ secrets.REDEPLOY_DEMO_URL }}
# Current DSpace maintenance branch (and architecture) which is deployed to demo.dspace.org / sandbox.dspace.org
# (NOTE: No deployment branch specified for sandbox.dspace.org as it uses the default_branch)
# Current DSpace branches (and architecture) which are deployed to demo.dspace.org & sandbox.dspace.org respectively
DEPLOY_DEMO_BRANCH: 'dspace-7_x'
DEPLOY_SANDBOX_BRANCH: 'main'
DEPLOY_ARCH: 'linux/amd64'

jobs:
Expand All @@ -93,6 +93,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
# This step converts the slashes in the "arch" matrix values above into dashes & saves to env.ARCH_NAME
# E.g. "linux/amd64" becomes "linux-amd64"
# This is necessary because all upload artifacts CANNOT have special chars (like slashes)
- name: Prepare
run: |
platform=${{ matrix.arch }}
echo "ARCH_NAME=${platform//\//-}" >> $GITHUB_ENV
# https://github.com/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v4
Expand Down Expand Up @@ -152,9 +160,9 @@ jobs:
# Upload digest to an artifact, so that it can be used in manifest below
- name: Upload Docker build digest to artifact
if: ${{ ! matrix.isPr }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: digests-${{ inputs.build_id }}
name: digests-${{ inputs.build_id }}-${{ env.ARCH_NAME }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
Expand All @@ -166,13 +174,13 @@ jobs:
!matrix.isPR &&
env.REDEPLOY_SANDBOX_URL != '' &&
matrix.arch == env.DEPLOY_ARCH &&
github.ref_name == github.event.repository.default_branch
github.ref_name == env.DEPLOY_SANDBOX_BRANCH
run: |
curl -X POST $REDEPLOY_SANDBOX_URL
# If this build is NOT a PR and passed in a REDEPLOY_DEMO_URL secret,
# Then redeploy https://demo.dspace.org if this build is for our deployment architecture and demo branch.
- name: Redeploy demo.dspace.org (based on maintenace branch)
- name: Redeploy demo.dspace.org (based on maintenance branch)
if: |
!matrix.isPR &&
env.REDEPLOY_DEMO_URL != '' &&
Expand All @@ -192,10 +200,12 @@ jobs:
- docker-build
steps:
- name: Download Docker build digests
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: digests-${{ inputs.build_id }}
path: /tmp/digests
# Download digests for both AMD64 and ARM64 into same directory
pattern: digests-${{ inputs.build_id }}-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
25 changes: 10 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ ENV MAVEN_FLAGS="-P-test-environment -Denforcer.skip=true -Dcheckstyle.skip=true
RUN mvn --no-transfer-progress package ${MAVEN_FLAGS} && \
mv /app/dspace/target/${TARGET_DIR}/* /install && \
mvn clean
# Remove the server webapp to keep image small.
RUN rm -rf /install/webapps/server/

# Step 2 - Run Ant Deploy
FROM openjdk:${JDK_VERSION}-slim as ant_build
FROM eclipse-temurin:${JDK_VERSION} as ant_build
ARG TARGET_DIR=dspace-installer
# COPY the /install directory from 'build' container to /dspace-src in this container
COPY --from=build /install /dspace-src
Expand All @@ -49,23 +51,16 @@ RUN mkdir $ANT_HOME && \
# Run necessary 'ant' deploy scripts
RUN ant init_installation update_configs update_code update_webapps

# Step 3 - Run tomcat
# Create a new tomcat image that does not retain the the build directory contents
FROM tomcat:10-jdk${JDK_VERSION}
# Step 3 - Start up DSpace via Runnable JAR
FROM eclipse-temurin:${JDK_VERSION}
# NOTE: DSPACE_INSTALL must align with the "dspace.dir" default configuration.
ENV DSPACE_INSTALL=/dspace
# Copy the /dspace directory from 'ant_build' container to /dspace in this container
COPY --from=ant_build /dspace $DSPACE_INSTALL
# Expose Tomcat port and AJP port
EXPOSE 8080 8009
WORKDIR $DSPACE_INSTALL
# Expose Tomcat port
EXPOSE 8080
# Give java extra memory (2GB)
ENV JAVA_OPTS=-Xmx2000m

# Link the DSpace 'server' webapp into Tomcat's webapps directory.
# This ensures that when we start Tomcat, it runs from /server path (e.g. http://localhost:8080/server/)
RUN ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/server
# If you wish to run "server" webapp off the ROOT path, then comment out the above RUN, and uncomment the below RUN.
# You also MUST update the 'dspace.server.url' configuration to match.
# Please note that server webapp should only run on one path at a time.
#RUN mv /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/ROOT.bk && \
# ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/ROOT
# On startup, run DSpace Runnable JAR
ENTRYPOINT ["java", "-jar", "webapps/server-boot.jar", "--dspace.dir=$DSPACE_INSTALL"]
13 changes: 9 additions & 4 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN mvn --no-transfer-progress package && \
mvn clean

# Step 2 - Run Ant Deploy
FROM openjdk:${JDK_VERSION}-slim as ant_build
FROM eclipse-temurin:${JDK_VERSION} as ant_build
ARG TARGET_DIR=dspace-installer
# COPY the /install directory from 'build' container to /dspace-src in this container
COPY --from=build /install /dspace-src
Expand All @@ -34,9 +34,9 @@ WORKDIR /dspace-src
ENV ANT_VERSION 1.10.13
ENV ANT_HOME /tmp/ant-$ANT_VERSION
ENV PATH $ANT_HOME/bin:$PATH
# Need wget to install ant, and unzip for managing AIPs
# Need wget to install ant
RUN apt-get update \
&& apt-get install -y --no-install-recommends wget unzip \
&& apt-get install -y --no-install-recommends wget \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*
# Download and install 'ant'
Expand All @@ -46,10 +46,15 @@ RUN mkdir $ANT_HOME && \
RUN ant init_installation update_configs update_code

# Step 3 - Run jdk
FROM openjdk:${JDK_VERSION}
FROM eclipse-temurin:${JDK_VERSION}
# NOTE: DSPACE_INSTALL must align with the "dspace.dir" default configuration.
ENV DSPACE_INSTALL=/dspace
# Copy the /dspace directory from 'ant_build' container to /dspace in this container
COPY --from=ant_build /dspace $DSPACE_INSTALL
# Give java extra memory (1GB)
ENV JAVA_OPTS=-Xmx1000m
# Install unzip for AIPs
RUN apt-get update \
&& apt-get install -y --no-install-recommends unzip \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*
2 changes: 1 addition & 1 deletion Dockerfile.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ARG JDK_VERSION=17

# Step 1 - Run Maven Build
FROM maven:3-openjdk-${JDK_VERSION}-slim as build
FROM maven:3-eclipse-temurin-${JDK_VERSION} as build
ARG TARGET_DIR=dspace-installer
WORKDIR /app
# Create the 'dspace' user account & home directory
Expand Down
33 changes: 12 additions & 21 deletions Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ ADD --chown=dspace . /app/
RUN mvn --no-transfer-progress package && \
mv /app/dspace/target/${TARGET_DIR}/* /install && \
mvn clean
# Remove the server webapp to keep image small. Rename runnable JAR to server-boot.jar.
RUN rm -rf /install/webapps/server/

# Step 2 - Run Ant Deploy
FROM openjdk:${JDK_VERSION}-slim as ant_build
FROM eclipse-temurin:${JDK_VERSION} as ant_build
ARG TARGET_DIR=dspace-installer
# COPY the /install directory from 'build' container to /dspace-src in this container
COPY --from=build /install /dspace-src
Expand All @@ -48,29 +50,18 @@ RUN mkdir $ANT_HOME && \
# Run necessary 'ant' deploy scripts
RUN ant init_installation update_configs update_code update_webapps

# Step 3 - Run tomcat
# Create a new tomcat image that does not retain the the build directory contents
FROM tomcat:10-jdk${JDK_VERSION}
# Step 3 - Start up DSpace via Runnable JAR
FROM eclipse-temurin:${JDK_VERSION}
# NOTE: DSPACE_INSTALL must align with the "dspace.dir" default configuration.
ENV DSPACE_INSTALL=/dspace
ENV TOMCAT_INSTALL=/usr/local/tomcat
# Copy the /dspace directory from 'ant_build' containger to /dspace in this container
# Copy the /dspace directory from 'ant_build' container to /dspace in this container
COPY --from=ant_build /dspace $DSPACE_INSTALL
# Enable the AJP connector in Tomcat's server.xml
# NOTE: secretRequired="false" should only be used when AJP is NOT accessible from an external network. But, secretRequired="true" isn't supported by mod_proxy_ajp until Apache 2.5
RUN sed -i '/Service name="Catalina".*/a \\n <Connector protocol="AJP/1.3" port="8009" address="0.0.0.0" redirectPort="8443" URIEncoding="UTF-8" secretRequired="false" />' $TOMCAT_INSTALL/conf/server.xml
# Expose Tomcat port and AJP port
EXPOSE 8080 8009 8000
WORKDIR $DSPACE_INSTALL
# Expose Tomcat port and debugging port
EXPOSE 8080 8000
# Give java extra memory (2GB)
ENV JAVA_OPTS=-Xmx2000m
# Set up debugging
ENV CATALINA_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:8000

# Link the DSpace 'server' webapp into Tomcat's webapps directory.
# This ensures that when we start Tomcat, it runs from /server path (e.g. http://localhost:8080/server/)
RUN ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/server
# If you wish to run "server" webapp off the ROOT path, then comment out the above RUN, and uncomment the below RUN.
# You also MUST update the 'dspace.server.url' configuration to match.
# Please note that server webapp should only run on one path at a time.
#RUN mv /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/ROOT.bk && \
# ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/ROOT

# On startup, run DSpace Runnable JAR
ENTRYPOINT ["java", "-jar", "webapps/server-boot.jar", "--dspace.dir=$DSPACE_INSTALL"]
1 change: 0 additions & 1 deletion docker-compose-cli.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
networks:
# Default to using network named 'dspacenet' from docker-compose.yml.
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
Expand Down
7 changes: 2 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.7'
networks:
dspacenet:
ipam:
Expand Down Expand Up @@ -40,8 +39,6 @@ services:
ports:
- published: 8080
target: 8080
- published: 8009
target: 8009
- published: 8000
target: 8000
stdin_open: true
Expand All @@ -55,14 +52,14 @@ services:
# Ensure that the database is ready BEFORE starting tomcat
# 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep
# 2. Then, run database migration to init database tables
# 3. Finally, start Tomcat
# 3. Finally, start DSpace
entrypoint:
- /bin/bash
- '-c'
- |
while (!</dev/tcp/dspacedb/5432) > /dev/null 2>&1; do sleep 1; done;
/dspace/bin/dspace database migrate
catalina.sh run
java -jar /dspace/webapps/server-boot.jar --dspace.dir=/dspace
# DSpace PostgreSQL database container
dspacedb:
container_name: dspacedb
Expand Down
24 changes: 9 additions & 15 deletions dspace-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,12 @@
<artifactId>commons-validator</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>jakarta.mail</artifactId>
</dependency>
<dependency>
Expand Down Expand Up @@ -733,27 +738,16 @@

<!-- TODO: This may need to be replaced with the "orcid-model" artifact once this ticket is resolved:
https://github.com/ORCID/orcid-model/issues/50 -->
<!-- Maintained at https://github.com/DSpace/orcid-model -->
<dependency>
<groupId>org.orcid</groupId>
<groupId>org.dspace</groupId>
<artifactId>orcid-model-jakarta</artifactId>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.jarkarta.rs</groupId>
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
</exclusion>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-jakarta</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -906,7 +900,7 @@
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.9.1</version>
<version>2.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Loading

0 comments on commit e6c24ae

Please sign in to comment.