Skip to content

Commit

Permalink
Updated profiles to optionally add former submodules into build/test
Browse files Browse the repository at this point in the history
Updated test workflow to add all former submodules into build/.test
Changed README.md instructions from submodules to subrepo
Updated build readme
  • Loading branch information
ivakegg committed Nov 27, 2024
1 parent a9278cd commit c868816
Show file tree
Hide file tree
Showing 19 changed files with 257 additions and 180 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
USER_NAME: ${{ secrets.USER_NAME }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
RUN_TESTS="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -ntp "-Dstyle.color=always" -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -Ddeploy -Ddist -T1C clean verify"
RUN_TESTS="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -ntp "-Dstyle.color=always" -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -Ddeploy -Ddist -T1C clean verify -Dutils -Dservices -Dstarters"
$RUN_TESTS \
|| { echo "***** TESTS FAILED. Attempting retry."; $RUN_TESTS; } \
|| { echo "***** TESTS FAILED. Attempting final retry."; $RUN_TESTS; }
Expand Down Expand Up @@ -110,14 +110,14 @@ jobs:
# USER_NAME: ${{ secrets.USER_NAME }}
# ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# run: |
# BUILD="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -DskipServices -Ddeploy -Ddist -T1C -pl "-:config-service" clean install -DskipTests"
# BUILD="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Dstarters -Dservices -Dutils -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -DonlyServiceApis -Ddeploy -Ddist -T1C -pl "-:config-service" clean install -DskipTests"
# $BUILD
# - name: Run Microservice Unit Tests
# env:
# USER_NAME: ${{ secrets.USER_NAME }}
# ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# run: |
# RUN_TESTS="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Dmaven.build.cache.enabled=false verify"
# RUN_TESTS="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Dstarters -Dservices -Dutils -Dmaven.build.cache.enabled=false verify"
# cd microservices
# $RUN_TESTS \
# || { echo "***** TESTS FAILED. Attempting retry."; $RUN_TESTS; } \
Expand Down Expand Up @@ -183,13 +183,13 @@ jobs:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
# update datawave dependencies to use the latest snapshots
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e versions:update-properties versions:update-parent -DallowSnapshots=true -Dincludes=gov.nsa.*
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Dstarters -Dservices -Dutils versions:update-properties versions:update-parent -DallowSnapshots=true -Dincludes=gov.nsa.*
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Ddeploy -Dtar -DskipTests clean install
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Dstarters -Dservices -Dutils -Pcompose -Dmicroservice-docker -Dquickstart-docker -Ddeploy -Dtar -DskipTests clean install
# free up some space so that we don't run out
docker system prune -f
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Ddeploy -Dtar -DskipTests clean
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Dstarters -Dservices -Dutils -Pcompose -Dmicroservice-docker -Dquickstart-docker -Ddeploy -Dtar -DskipTests clean
cd docker
./bootstrap.sh
Expand Down Expand Up @@ -264,10 +264,10 @@ jobs:
-Durl.hadoop=https://bogus.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz \
-Durl.maven=https://bogus.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz"
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Dquickstart-maven ${DIST_URLS} -Ddeploy -Dtar -DskipTests -Dmaven.build.cache.enabled=false clean install
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Dstarters -Dservices -Dutils -Pcompose -Dmicroservice-docker -Dquickstart-docker -Dquickstart-maven ${DIST_URLS} -Ddeploy -Dtar -DskipTests -Dmaven.build.cache.enabled=false clean install
# free up some space so that we don't run out
docker system prune -f
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Dquickstart-maven ${DIST_URLS} -Ddeploy -Dtar -DskipTests -Dmaven.build.cache.enabled=false clean
mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Dstarters -Dservices -Dutils -Pcompose -Dmicroservice-docker -Dquickstart-docker -Dquickstart-maven ${DIST_URLS} -Ddeploy -Dtar -DskipTests -Dmaven.build.cache.enabled=false clean
cd docker
./bootstrap.sh
attempt=0
Expand Down
2 changes: 1 addition & 1 deletion BUILDME.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ mvn -Pdev,assemble,rpm -Ddeploy -Dtar -Ddist -DskipTests clean install
Datawave web services utilize several microservices at runtime (currently authorization and auditing, although that
list will expand soon). Datawave depends on api modules for some of these services, and the dependencies are set in
the parent pom (see `version.datawave.*` properties) to released versions. If you wish to build the microservices
for some reason, you can simply add `-Dservices` to your maven build command.
for some reason, you can simply add `-Dservices` to your maven build command. If you wish to build the starters you can add `-Dstarters` and for the utility modules add `-Dutils`.

### Releasing Microservices

Expand Down
97 changes: 64 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,73 @@ Basic build instructions are [here](BUILDME.md)

## How to Use this Repository

The microservices and associated utility projects are intended to be
developed, versioned, and released independently and as such are stored
in separate repositories. This repository includes them all as submodules
in order to provide an easy way to import them all in an IDE for viewing
the code, or refactoring. [Git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
require some extra commands over the normal ones that one may be familiar
with.

### Cloning with all submodules
Cloning with all of the submodules is not required; however, if you are interested in checking
out and building all of the datawave projects under one repo, read this!

It's easiest to clone the repository pointing the submodules at the same branch
```bash
# Start out by cloning the project as you normally would.
git clone [email protected]:NationalSecurityAgency/datawave.git

# Now, use git to retrieve all of the datawave submodules.
# This will leave your submodules in a detached head state.
cd datawave
git submodule update --init --recursive

# You can checkout the main branch for each submodule so that you are no longer in a detached head state.
# The addition of `|| :` will ensure that the command is executed for each submodule,
# ignoring failures for submodules that don't have a main branch.
git submodule foreach 'git checkout main || :'

# It is recommended to build the project using multiple threads.
mvn -Pdocker,dist clean install -T 1C
The microservices and associated utility projects are intended to be developed, versioned,
and released independently. The following subdirectories contain those independently
versioned modules:

```
core/utils/type-utils
contrib/datawave-utils
core/base-rest-responses
core/in-memory-accumulo
core/metrics-reporter
core/utils/accumulo-utils
core/utils/common-utils
core/utils/metadata-utils
microservices/microservice-parent
microservices/microservice-service-parent
microservices/starters/audit
microservices/starters/cache
microservices/starters/cached-results
microservices/starters/datawave
microservices/starters/metadata
microservices/starters/query
microservices/starters/query-metric
microservices/services/accumulo
microservices/services/audit
microservices/services/authorization
microservices/services/config
microservices/services/dictionary
microservices/services/file-provider
microservices/services/hazelcast
microservices/services/map
microservices/services/mapreduce-query
microservices/services/modification
microservices/services/query
microservices/services/query-executor
microservices/services/query-metric
```

# If you don't want to build the microservices, you can skip them.
mvn -Pdocker,dist -DskipMicroservices clean install -T 1C
Each of those subdirectories contain a .gitrepo file that keeps track of where the code came from.

# If you decide that you no longer need the submodules, you can remove them.
git submodule deinit --all
### Updating one of the datawave sub-repositories
At one point we used submodules to link in a all of the sub-repositories. We have now switched
to including the submodules' code directly into the main datawave repository. The git subrepo
mechanism (https://github.com/ingydotnet/git-subrepo) was used to facilitate the transition.
That same mechanism can be used to pull in changes from the other repositories as needed until
they can be removed altogether. The original cloning of the sub repositories was done using
the subrepo command as follows:
```
git subrepo clone <repo> <dir>
```
If changes need to be pulled in, then the following process can be used:
```
git subrepo pull <dir>
```
### Building

It is recommended to build the project using multiple threads.
```
mvn -Pdocker,dist clean install -T 1C
```

If you don't want to build the starters, util modules, and services then try this
```
mvn -Pdocker,dist -Dstarters -Dservices -Dutils clean install -T 1C
```

NOTE: The util modules, starters, and services are actually tagged and deployed separately.
Hence the snapshot versions within those sub repos are not connected together.

### DataWave Microservices

Expand Down
37 changes: 25 additions & 12 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,37 +87,50 @@
</build>
<profiles>
<profile>
<id>submodule-base-rest-responses</id>
<id>base-rest-responses</id>
<activation>
<file>
<exists>base-rest-responses/pom.xml</exists>
</file>
<property>
<name>base-rest-responses</name>
</property>
</activation>
<modules>
<module>base-rest-responses</module>
</modules>
</profile>
<profile>
<id>submodule-in-memory-accumulo</id>
<id>in-memory-accumulo</id>
<activation>
<file>
<exists>in-memory-accumulo/pom.xml</exists>
</file>
<property>
<name>in-memory-accumulo</name>
</property>
</activation>
<modules>
<module>in-memory-accumulo</module>
</modules>
</profile>
<profile>
<id>submodule-metrics-reporter</id>
<id>metrics-reporter</id>
<activation>
<file>
<exists>metrics-reporter/pom.xml</exists>
</file>
<property>
<name>metrics-reporter</name>
</property>
</activation>
<modules>
<module>metrics-reporter</module>
</modules>
</profile>
<profile>
<id>utils</id>
<activation>
<property>
<name>utils</name>
</property>
</activation>
<modules>
<module>base-rest-responses</module>
<module>in-memory-accumulo</module>
<module>metrics-reporter</module>
</modules>
</profile>
</profiles>
</project>
46 changes: 30 additions & 16 deletions core/utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,62 @@
<modules />
<profiles>
<profile>
<id>submodule-accumulo-utils</id>
<id>accumulo-utils</id>
<activation>
<file>
<exists>accumulo-utils/pom.xml</exists>
</file>
<property>
<name>accumulo-utils</name>
</property>
</activation>
<modules>
<module>accumulo-utils</module>
</modules>
</profile>
<profile>
<id>submodule-common-utils</id>
<id>common-utils</id>
<activation>
<file>
<exists>common-utils/pom.xml</exists>
</file>
<property>
<name>common-utils</name>
</property>
</activation>
<modules>
<module>common-utils</module>
</modules>
</profile>
<profile>
<id>submodule-metadata-utils</id>
<id>metadata-utils</id>
<activation>
<file>
<exists>metadata-utils/pom.xml</exists>
</file>
<property>
<name>metadata-utils</name>
</property>
</activation>
<modules>
<module>metadata-utils</module>
</modules>
</profile>
<profile>
<id>submodule-type-utils</id>
<id>type-utils</id>
<activation>
<file>
<exists>type-utils/pom.xml</exists>
</file>
<property>
<name>type-utils</name>
</property>
</activation>
<modules>
<module>type-utils</module>
</modules>
</profile>
<profile>
<id>utils</id>
<activation>
<property>
<name>utils</name>
</property>
</activation>
<modules>
<module>accumulo-utils</module>
<module>common-utils</module>
<module>metadata-utils</module>
<module>type-utils</module>
</modules>
</profile>
</profiles>
</project>
24 changes: 2 additions & 22 deletions microservices/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,12 @@
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
<module>microservice-parent</module>
<module>microservice-service-parent</module>
<module>services</module>
<module>starters</module>
</modules>
<profiles>
<profile>
<id>submodule-microservice-parent</id>
<activation>
<file>
<exists>microservice-parent/pom.xml</exists>
</file>
</activation>
<modules>
<module>microservice-parent</module>
</modules>
</profile>
<profile>
<id>submodule-microservice-service-parent</id>
<activation>
<file>
<exists>microservice-service-parent/pom.xml</exists>
</file>
</activation>
<modules>
<module>microservice-service-parent</module>
</modules>
</profile>
<profile>
<id>configcheck</id>
<activation>
Expand Down
2 changes: 1 addition & 1 deletion microservices/services/accumulo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<id>services</id>
<activation>
<property>
<name>!skipServices</name>
<name>!onlyServiceApis</name>
</property>
</activation>
<modules>
Expand Down
2 changes: 1 addition & 1 deletion microservices/services/audit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<id>services</id>
<activation>
<property>
<name>!skipServices</name>
<name>!onlyServiceApis</name>
</property>
</activation>
<modules>
Expand Down
2 changes: 1 addition & 1 deletion microservices/services/authorization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<id>services</id>
<activation>
<property>
<name>!skipServices</name>
<name>!onlyServiceApis</name>
</property>
</activation>
<modules>
Expand Down
2 changes: 1 addition & 1 deletion microservices/services/dictionary/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<id>services</id>
<activation>
<property>
<name>!skipServices</name>
<name>!onlyServiceApis</name>
</property>
</activation>
<modules>
Expand Down
Loading

0 comments on commit c868816

Please sign in to comment.