Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DevDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ENV APPDIR=/opt/service

# Set environment variables from build arguments
ARG BUILD_NUMBER=0
ENV BUILD_NUMBER=$APP_VERSION
ARG APP_VERSION="UNKNOWN"
ENV BUILD_NUMBER=$APP_VERSION
ENV APP_VERSION=$APP_VERSION
ARG BUILD_SHA="UNKNOWN"
ENV BUILD_SHA=$BUILD_SHA
Expand Down Expand Up @@ -41,7 +41,7 @@ RUN gem install nokogiri:1.16.0 --no-document && \

# REUSE
RUN pip3 install --break-system-packages setuptools
RUN pip3 install --break-system-packages reuse==3.0.1
RUN pip3 install --break-system-packages reuse==6.2.0

RUN git config --global --add safe.directory '*'

Expand All @@ -53,11 +53,11 @@ RUN mkdir -p "${APPDIR}" && cp -a /tmp/node_modules "${APPDIR}"
WORKDIR "${APPDIR}"
COPY . "${APPDIR}"

ENV NODE_ENV "localhost"
ENV NODE_ENV="localhost"

# Uncomment this if you want to see debug output
#ENV DEBUG=*

ENV PORT 5000
ENV PORT=5000
EXPOSE 5000
ENTRYPOINT ["node", "index.js"]
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN gem install nokogiri:1.16.0 --no-document && \

# REUSE
RUN pip3 install --break-system-packages setuptools
RUN pip3 install --break-system-packages reuse==3.0.1
RUN pip3 install --break-system-packages reuse==6.2.0

# Crawler config
ENV CRAWLER_DEADLETTER_PROVIDER=cd(azblob)
Expand All @@ -58,6 +58,6 @@ RUN mkdir -p "${APPDIR}" && cp -a /tmp/node_modules "${APPDIR}"
WORKDIR "${APPDIR}"
COPY . "${APPDIR}"

ENV PORT 5000
ENV PORT=5000
EXPOSE 5000
ENTRYPOINT ["node", "index.js"]
16 changes: 14 additions & 2 deletions providers/process/fsfeReuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class FsfeReuseProcessor extends AbstractProcessor {
super(options)
// Kick off version detection but don't wait. We'll wait before processing anything...
this._versionPromise = this._detectVersion()
// Log the resolved version when it's available
this._versionPromise.then(schemaVersion => {
this.logger?.info(`Detected REUSE tool version: ${this._toolVersion}, schema version: ${schemaVersion}`)
})
}

get toolVersion() {
Expand Down Expand Up @@ -145,10 +149,17 @@ class FsfeReuseProcessor extends AbstractProcessor {

_detectVersion() {
if (this._versionPromise !== undefined) return this._versionPromise

this._versionPromise = execFile('reuse', ['--version'])
.then(result => {
const reuseRegex = /reuse\s+(\d+\.\d+(\.\d+)?)/i
this._toolVersion = result.stdout.trim().match(reuseRegex)[1]
const reuseRegex = /reuse[^\d]*(\d+\.\d+(?:\.\d+)?)/i
const match = result.stdout.trim().match(reuseRegex)

if (!match) {
throw new Error(`Could not parse version from output: ${result.stdout}`)
}

this._toolVersion = match[1]
this._schemaVersion = this.aggregateVersions(
[this._schemaVersion, this.toolVersion, this.configVersion],
'Invalid REUSE version'
Expand All @@ -158,6 +169,7 @@ class FsfeReuseProcessor extends AbstractProcessor {
.catch(error => {
if (error) this.logger.warn(`Could not detect version of REUSE: ${error.message}`)
})

return this._versionPromise
}
}
Expand Down