Skip to content

Commit 08d62e7

Browse files
committed
Merge branch 'master' of github.com:oracle/opengrok into lucene-9.10.0
2 parents 160984e + 785896c commit 08d62e7

File tree

78 files changed

+1610
-785
lines changed

Some content is hidden

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

78 files changed

+1610
-785
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
4+
# Maintain dependencies for GitHub Actions
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
10+
- package-ecosystem: "docker"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
- name: Install Universal ctags (Windows)
4545
if: runner.os == 'Windows'
4646
run: choco install universal-ctags
47-
- name: Before build actions (Unix)
48-
if: runner.os == 'Linux' || runner.os == 'macOS'
47+
- name: Before build actions
48+
shell: bash
4949
run: ./dev/before
5050
- name: Maven build
5151
shell: bash

.github/workflows/docker.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
name: Build Docker image
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types: [created]
48

59
jobs:
610
ubuntu:
711
runs-on: ubuntu-latest
812
steps:
13+
- name: Print environment
14+
shell: bash
15+
run: env
916
- name: Checkout master branch
1017
uses: actions/checkout@v4
1118
- uses: actions/setup-python@v5
@@ -31,15 +38,13 @@ jobs:
3138
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
3239
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
3340
OPENGROK_REPO_SLUG: ${{ github.repository }}
34-
OPENGROK_PULL_REQUEST: ${{ github.head_ref }}
3541
OPENGROK_REF: ${{ github.ref }}
3642
run: ./dev/docker.sh
3743
- name: Install Python pre-requisites
3844
run: python3 -m pip install requests
3945
- name: Optionally update README on Docker hub
4046
env:
4147
OPENGROK_REPO_SLUG: ${{ github.repository }}
42-
OPENGROK_PULL_REQUEST: ${{ github.head_ref }}
4348
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
4449
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
4550
run: ./dev/dockerhub_readme.py

.github/workflows/release.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Release
22

33
# TODO: run this only for the oracle/opengrok repository
44
on:
5-
push:
6-
tags:
7-
- '[1-9]+.[0-9]+.[0-9]+'
5+
release:
6+
types: [created]
87

98
jobs:
109
get_tag:
@@ -48,23 +47,18 @@ jobs:
4847
run: ./dev/before
4948
- name: Build
5049
run: ./mvnw -DskipTests=true -Dmaven.javadoc.skip=false -B -V package
51-
- name: Create Release
52-
id: create_release
53-
uses: actions/create-release@v1
50+
- name: Get upload URL
51+
id: get_upload_url
5452
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
with:
57-
tag_name: ${{ github.ref }}
58-
release_name: ${{ github.ref }}
59-
draft: false
60-
prerelease: false
53+
OPENGROK_TAG: ${{ needs.get_tag.outputs.tag }}
54+
run: dev/get_upload_url.sh
6155
- name: Upload release tarball
6256
id: upload-release-asset
6357
uses: actions/upload-release-asset@v1
6458
env:
6559
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6660
with:
67-
upload_url: ${{ steps.create_release.outputs.upload_url }}
61+
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
6862
asset_path: ./distribution/target/opengrok-${{ needs.get_tag.outputs.tag }}.tar.gz
6963
asset_name: opengrok-${{ needs.get_tag.outputs.tag }}.tar.gz
7064
asset_content_type: application/octet-stream

Dockerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ RUN cp `ls -t distribution/target/*.tar.gz | head -1` /opengrok.tar.gz
4141
# Store the version in a file so that the tools can report it.
4242
RUN /mvn/mvnw help:evaluate -Dexpression=project.version -q -DforceStdout > /mvn/VERSION
4343

44-
FROM tomcat:10.1.19-jdk17
44+
FROM tomcat:10.1.30-jdk17
4545
LABEL maintainer="https://github.com/oracle/opengrok"
46+
LABEL org.opencontainers.image.source="https://github.com/oracle/opengrok"
47+
LABEL org.opencontainers.image.description="OpenGrok code search"
4648

4749
# Add Perforce apt source.
4850
# hadolint ignore=DL3008,DL3009
@@ -64,11 +66,11 @@ RUN apt-get update && \
6466
# hadolint ignore=DL3008,DL3059
6567
RUN architecture=$(uname -m) && if [[ "$architecture" == "aarch64" ]]; then \
6668
echo "aarch64: do not install helix-p4d."; else \
67-
apt-get install --no-install-recommends -y helix-p4d; fi
69+
apt-get install --no-install-recommends -y helix-p4d || echo "Failed to install Perforce"; fi
6870

6971
# compile and install universal-ctags
7072
# hadolint ignore=DL3003,DL3008
71-
RUN apt-get install --no-install-recommends -y pkg-config automake build-essential && \
73+
RUN apt-get install --no-install-recommends -y pkg-config automake build-essential libxml2-dev && \
7274
git clone https://github.com/universal-ctags/ctags /root/ctags && \
7375
cd /root/ctags && ./autogen.sh && ./configure && make && make install && \
7476
apt-get remove -y automake build-essential && \
@@ -77,19 +79,17 @@ RUN apt-get install --no-install-recommends -y pkg-config automake build-essenti
7779
apt-get clean && \
7880
rm -rf /var/lib/apt/lists/*
7981

80-
# Update the Python tooling in order to successfully install the opengrok-tools package.
81-
# hadolint ignore=DL3013
82-
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools
83-
8482
# prepare OpenGrok binaries and directories
8583
# hadolint ignore=DL3010
8684
COPY --from=build opengrok.tar.gz /opengrok.tar.gz
8785
# hadolint ignore=DL3013
8886
RUN mkdir -p /opengrok /opengrok/etc /opengrok/data /opengrok/src && \
8987
tar -zxvf /opengrok.tar.gz -C /opengrok --strip-components 1 && \
9088
rm -f /opengrok.tar.gz && \
91-
python3 -m pip install --no-cache-dir /opengrok/tools/opengrok-tools.tar.gz && \
92-
python3 -m pip install --no-cache-dir Flask Flask-HTTPAuth waitress # for /reindex REST endpoint handled by start.py
89+
python3 -m venv /venv
90+
ENV PATH=/venv/bin:$PATH
91+
RUN /venv/bin/python3 -m pip install --no-cache-dir /opengrok/tools/opengrok-tools.tar.gz && \
92+
/venv/bin/python3 -m pip install --no-cache-dir Flask Flask-HTTPAuth waitress # for /reindex REST endpoint handled by start.py
9393

9494
COPY --from=build /mvn/VERSION /opengrok/VERSION
9595

dev/before_install

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ if [[ "$RUNNER_OS" == "Linux" ]]; then
2828
# Bitkeeper install failure is not critical, so exit code is not checked.
2929
sudo ./dev/install-bitkeeper.sh
3030

31-
sudo -H ./dev/install-python-packages.sh
32-
if [[ $? != 0 ]]; then
33-
echo "cannot install Python packages"
34-
exit 1
35-
fi
36-
3731
sudo ./dev/install-universal_ctags.sh
3832
if [[ $? != 0 ]]; then
3933
echo "cannot install Universal ctags"
@@ -49,15 +43,6 @@ elif [[ "$RUNNER_OS" == "macOS" ]]; then
4943
exit 1
5044
fi
5145

52-
brew install python3
53-
brew upgrade python
54-
55-
./dev/install-python-packages.sh
56-
if [[ $? != 0 ]]; then
57-
echo "cannot install Python packages"
58-
exit 1
59-
fi
60-
6146
sudo ./dev/install-universal_ctags.sh
6247
if [[ $? != 0 ]]; then
6348
echo "cannot install Universal ctags"

dev/docker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ docker run -d $IMAGE
6262
docker ps -a
6363

6464
# This can only work on home repository since it needs encrypted variables.
65-
if [[ -n "$OPENGROK_PULL_REQUEST" ]]; then
65+
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
6666
echo "Not pushing Docker image for pull requests"
6767
exit 0
6868
fi
@@ -75,12 +75,12 @@ fi
7575

7676
if [[ -z $DOCKER_USERNAME ]]; then
7777
echo "DOCKER_USERNAME is empty, exiting"
78-
exit 0
78+
exit 1
7979
fi
8080

8181
if [[ -z $DOCKER_PASSWORD ]]; then
8282
echo "DOCKER_PASSWORD is empty, exiting"
83-
exit 0
83+
exit 1
8484
fi
8585

8686
# Publish the image to Docker hub.

dev/dockerhub_readme.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def check_push_env():
8585
logger.info("Not updating Docker hub README for non main repo")
8686
sys.exit(0)
8787

88-
pull_request = os.environ.get("OPENGROK_PULL_REQUEST")
89-
if pull_request and len(pull_request) > 0:
88+
event_type = os.environ.get("GITHUB_EVENT_NAME")
89+
if event_type and event_type == "pull_request":
9090
logger.info("Not updating Docker hub README for pull requests")
9191
sys.exit(0)
9292

dev/get_upload_url.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
#
3+
# The purpose of this script is to retrieve upload URL for OpenGrok release given by the tag
4+
# stored in the OPENGROK_TAG environment variable.
5+
# The value is stored in a special file consumed by Github action so that it can be used
6+
# to upload assets to the related OpenGrok release on Github.
7+
#
8+
9+
echo "Getting upload URL for $OPENGROK_TAG"
10+
upload_url=$( curl -s https://api.github.com/repos/oracle/opengrok/releases/tags/$OPENGROK_TAG | jq -r .upload_url )
11+
echo "Got '$upload_url'"
12+
if [[ -n $GITHUB_OUTPUT ]]; then
13+
echo "upload_url=$upload_url" >> $GITHUB_OUTPUT
14+
fi

dev/ref2tag.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
tag=${OPENGROK_REF#"refs/tags/"}
4-
echo "::set-output name=tag::$tag"
4+
echo "tag=$tag" >> $GITHUB_OUTPUT

dev/release.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
22
#
3-
# Trigger new release creation on Github.
4-
# Assumes working Maven + Git.
5-
#
3+
# Query current release or trigger new release creation on Github.
4+
# For the latter, it merely kick-starts the creation of new Release on Github,
65
# see https://github.com/oracle/opengrok/wiki/Release-process
76
#
7+
# Assumes working Maven + Git.
8+
#
89

910
set -e
1011

@@ -43,8 +44,10 @@ if [[ $ver == $VERSION ]]; then
4344
fi
4445

4546
git pull --ff-only
47+
git switch -c "release_${VERSION}"
4648
./mvnw versions:set -DgenerateBackupPoms=false "-DnewVersion=$VERSION"
4749
git commit pom.xml '**/pom.xml' -m "$VERSION"
4850
git push
49-
git tag "$VERSION"
50-
git push origin tag "$VERSION"
51+
echo
52+
echo "Create PR with the changes. Once it is merged in, create new release."
53+
echo

distribution/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.opengrok</groupId>
99
<artifactId>opengrok-top</artifactId>
10-
<version>1.13.7</version>
10+
<version>1.13.23</version>
1111
</parent>
1212

1313
<artifactId>opengrok-dist</artifactId>
@@ -28,20 +28,20 @@
2828
<dependency>
2929
<groupId>org.opengrok</groupId>
3030
<artifactId>opengrok</artifactId>
31-
<version>1.13.7</version>
31+
<version>1.13.23</version>
3232
</dependency>
3333

3434
<dependency>
3535
<groupId>org.opengrok</groupId>
3636
<artifactId>opengrok-web</artifactId>
37-
<version>1.13.7</version>
37+
<version>1.13.23</version>
3838
<type>war</type>
3939
</dependency>
4040

4141
<dependency>
4242
<groupId>org.opengrok</groupId>
4343
<artifactId>tools</artifactId>
44-
<version>1.13.7</version>
44+
<version>1.13.23</version>
4545
<type>pom</type>
4646
</dependency>
4747
</dependencies>

docker/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ The image contains these directories:
9595
| ----------------------- | ------------- | ----------- |
9696
`SYNC_PERIOD_MINUTES` | 10 | Period of automatic synchronization (i.e. mirroring + reindexing) in minutes. Setting to `0` will disable periodic syncing (the sync after container startup will still be done).
9797
`INDEXER_OPT` | empty | pass **extra** options to OpenGrok Indexer. For example, `-i d:vendor` will remove all the `*/vendor/*` files from the index. You can check the indexer options on https://github.com/oracle/opengrok/wiki/Python-scripts-transition-guide. The default set of indexer options is: `--remote on -P -H -W`. Do not add `-R` as it is used internally. Rather, see below for the `READONLY_CONFIG_FILE` environment variable.
98+
`INDEXER_JAVA_OPTS` | empty | pass **extra** Java options to OpenGrok Indexer.
9899
`NOMIRROR` | empty | To avoid the mirroring step, set the variable to non-empty value.
99100
`URL_ROOT` | `/` | Override the sub-URL that OpenGrok should run on.
100101
`WORKERS` | number of CPUs in the container | number of workers to use for syncing (applies only to setup with projects enabled)
@@ -168,7 +169,7 @@ If you want to do your own development, you can build the image yourself:
168169

169170
git clone https://github.com/oracle/opengrok.git
170171
cd opengrok
171-
docker build -t opengrok-dev .
172+
docker buildx build -t opengrok-dev .
172173

173174
Then run the container:
174175

docker/start.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ def indexer_no_projects(logger, uri, config_path, extra_indexer_options):
323323
Project less indexer
324324
"""
325325

326+
indexer_java_opts = os.environ.get("INDEXER_JAVA_OPTS")
327+
if indexer_java_opts:
328+
indexer_java_opts = indexer_java_opts.split()
329+
326330
wait_for_tomcat(logger, uri)
327331

328332
while True:
@@ -347,7 +351,11 @@ def indexer_no_projects(logger, uri, config_path, extra_indexer_options):
347351
)
348352
indexer_options.extend(extra_indexer_options.split())
349353
indexer = Indexer(
350-
indexer_options, logger=logger, jar=OPENGROK_JAR, doprint=True
354+
indexer_options,
355+
java_opts=indexer_java_opts,
356+
logger=logger,
357+
jar=OPENGROK_JAR,
358+
doprint=True,
351359
)
352360
indexer.execute()
353361

@@ -421,6 +429,10 @@ def create_bare_config(logger, use_projects, extra_indexer_options=None):
421429
Create bare configuration file with a few basic settings.
422430
"""
423431

432+
indexer_java_opts = os.environ.get("INDEXER_JAVA_OPTS")
433+
if indexer_java_opts:
434+
indexer_java_opts = indexer_java_opts.split()
435+
424436
logger.info("Creating bare configuration in {}".format(OPENGROK_CONFIG_FILE))
425437
indexer_options = [
426438
"-s",
@@ -444,7 +456,13 @@ def create_bare_config(logger, use_projects, extra_indexer_options=None):
444456
indexer_options.extend(extra_indexer_options)
445457
if use_projects:
446458
indexer_options.append("-P")
447-
indexer = Indexer(indexer_options, jar=OPENGROK_JAR, logger=logger, doprint=True)
459+
indexer = Indexer(
460+
indexer_options,
461+
java_opts=indexer_java_opts,
462+
jar=OPENGROK_JAR,
463+
logger=logger,
464+
doprint=True,
465+
)
448466
indexer.execute()
449467
ret = indexer.getretcode()
450468
if ret != SUCCESS_EXITVAL:
@@ -473,12 +491,20 @@ def check_index_and_wipe_out(logger):
473491
currently running version and the CHECK_INDEX environment variable
474492
is non-empty, wipe out the directories under data root.
475493
"""
494+
indexer_java_opts = os.environ.get("INDEXER_JAVA_OPTS")
495+
if indexer_java_opts:
496+
indexer_java_opts = indexer_java_opts.split()
497+
476498
check_index = os.environ.get("CHECK_INDEX")
477499
if check_index and os.path.exists(OPENGROK_CONFIG_FILE):
478500
logger.info("Checking if index matches current version")
479501
indexer_options = ["-R", OPENGROK_CONFIG_FILE, "--checkIndex", "version"]
480502
indexer = Indexer(
481-
indexer_options, logger=logger, jar=OPENGROK_JAR, doprint=True
503+
indexer_options,
504+
java_opts=indexer_java_opts,
505+
logger=logger,
506+
jar=OPENGROK_JAR,
507+
doprint=True,
482508
)
483509
indexer.execute()
484510
if indexer.getretcode() == 1:

0 commit comments

Comments
 (0)