Skip to content

Commit

Permalink
[fixup] Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 committed Jul 26, 2023
1 parent 9d71b60 commit 7f6e667
Show file tree
Hide file tree
Showing 9 changed files with 608 additions and 9 deletions.
513 changes: 513 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile-4_0
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ COPY management-api-agent-4.1.x ./management-api-agent-4.1.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mkdir -m 775 ${MAAC_PATH} && \
mvn -q -ff package -DskipTests && \
mvn -q -ff package -DskipTests -DskipOpenApi && \
find /build -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + && \
rm $MAAC_PATH/datastax-mgmtapi-agent-3* && \
rm $MAAC_PATH/datastax-mgmtapi-*common* && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-4_0.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ COPY management-api-common /tmp/management-api-common
COPY management-api-server /tmp/management-api-server
RUN mkdir -m 775 ${MAAC_PATH} \
&& cd /tmp \
&& mvn -q -ff package -DskipTests \
&& mvn -q -ff package -DskipTests -DskipOpenApi \
&& find /tmp -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + \
&& rm ${MAAC_PATH}/datastax-mgmtapi-agent-3.x* \
&& rm ${MAAC_PATH}/datastax-mgmtapi-agent-4.1.x* \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-4_1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ COPY management-api-agent-4.1.x ./management-api-agent-4.1.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mkdir -m 775 ${MAAC_PATH} && \
mvn -q -ff package -DskipTests && \
mvn -q -ff package -DskipTests -DskipOpenApi && \
find /build -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + && \
rm $MAAC_PATH/datastax-mgmtapi-agent-3* && \
rm $MAAC_PATH/datastax-mgmtapi-*common* && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-4_1.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ COPY management-api-common /tmp/management-api-common
COPY management-api-server /tmp/management-api-server
RUN mkdir -m 775 ${MAAC_PATH} \
&& cd /tmp \
&& mvn -q -ff package -DskipTests \
&& mvn -q -ff package -DskipTests -DskipOpenApi \
&& find /tmp -type f -name "datastax-*.jar" -exec mv -t ${MAAC_PATH} -i '{}' + \
&& rm ${MAAC_PATH}/datastax-mgmtapi-agent-3.x* \
&& rm ${MAAC_PATH}/datastax-mgmtapi-agent-4.x* \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-oss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ COPY management-api-agent-4.1.x ./management-api-agent-4.1.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mkdir -m 775 ${MAAC_PATH} && \
mvn -q -ff package -DskipTests && \
mvn -q -ff package -DskipTests -DskipOpenApi && \
find /build -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + && \
rm $MAAC_PATH/datastax-mgmtapi-agent-4* && \
rm $MAAC_PATH/datastax-mgmtapi-*common* && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-oss.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ COPY management-api-common /tmp/management-api-common
COPY management-api-server /tmp/management-api-server
RUN mkdir -m 775 ${MAAC_PATH} \
&& cd /tmp \
&& mvn -q -ff package -DskipTests \
&& mvn -q -ff package -DskipTests -DskipOpenApi \
&& find /tmp -type f -name "datastax-*.jar" -exec mv -t ${MAAC_PATH} -i '{}' + \
&& rm ${MAAC_PATH}/datastax-mgmtapi-agent-4.x* \
&& rm ${MAAC_PATH}/datastax-mgmtapi-agent-4.1.x* \
Expand Down
79 changes: 76 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,18 +391,91 @@ git commit

## API Client Generation

In addition to automatic OpenAPI document generation, a Golang client can be generated during the build by enabling the `clientgen` Maven profile. The client is built using the [OpenAPI Tools generator Maven plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin) and can be used by Go projects to interact with the Management API. The client generation happens during the `process-classes` phase of the Maven build so that changes to the API implementation can be compiled into an OpenAPI document spec file [during the compile phase](#changes-to-api-endpoints) of the build. The client code is generated in the `target` directory under the [management-api-server](management-api-server) sub-module and should be located at
In addition to automatic OpenAPI document generation, a Golang client or a Java client can be generated during the build (unfortunately, only
one of them can be generated at a time, but you can run the `process-classes` goal back-to-back to generate them both). The Java client generation
is enabled by default (or can be explicitly enabled with the `java-clientgen` Maven profile). The Go client generation is disabled by default
and can be enabled with the `go-clientgen` Maven profile. The clients are built using the
[OpenAPI Tools generator Maven plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin)
and can be used by projects to interact with the Management API. The client generation happens during the `process-classes`
phase of the Maven build so that changes to the API implementation can be compiled into an OpenAPI document spec file
[during the compile phase](#changes-to-api-endpoints) of the build. The client code is generated in the `target` directory under
the [management-api-server](management-api-server) sub-module and should be located at

```sh
management-api-server/target/generated-sources/openapi
```

To generate the client, run the following from the root of the project:
To generate the Go client, run the following from the root of the project:

```sh
mvn clean process-classes -Pclientgen
mvn process-classes -P go-clientgen
```

The Go client code will be generated in `management-api-server/target/generated-sources/openapi/go-client`

To generate the Java client, run the following from the root of the project:

```sh
mvn process-classes -P java-clientgen
```

or simply:

```sh
mvn process-classes
```

The Java client code will be generated in `management-api-server/target/generated-sources/openapi/java-client`

### Maven coordinates for the Java generated client

This project also has a workflow_dispatch job that will publish the current `master` branch version of the Java
generated client to the Datastax public Maven repository. To pull in this artifact in a Maven project, you will
need to add the Datastax Artifactory repository to your Maven settings:

```xml
<profiles>
<profile>
<id>datastax</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>datastax-artifactory</id>
<name>DataStax Artifactory</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<url>https://repo.datastax.com</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
</profiles>
```

At the current time, the artifact for the Java client will have a version that contains the Git Hash of the commit it
was built from. To add the artifact to your Maven project as a dependency, you will need something like this in your pom.xml:

```xml
<project>
<dependencies>
<dependency>
<groupId>io.k8ssandra</groupId>
<artifactId>datastax-mgmtapi-client-openapi</artifactId>
<version>0.1.0-9d71b60</version>
</dependency>
</dependnecies>
</project>
```

where `9d71b60` is the hash of the release you want.

Eventually, this artifact will be published into Maven Central and have a regular release version (i.e. 0.1.0).

## Published Docker images

When PRs are merged into the `master` branch, if all of the integration tests pass, the CI process will build and publish all supported Docker images with GitHub commit SHA tags. These images are not intended to be used in production. They are meant for facilitating testing with dependent projects.
Expand Down
13 changes: 13 additions & 0 deletions gen_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
previous_tag=0
for current_tag in $(git tag --sort=-creatordate)
do

if [ "$previous_tag" != 0 ];then
tag_date=$(git log -1 --pretty=format:'%ad' --date=short ${previous_tag})
printf "## ${previous_tag} (${tag_date})\n\n"
git log ${current_tag}...${previous_tag} --pretty=format:'* %s [View](https://github.com/k8ssandra/management-api-for-apache-cassandra/commit/%H)' --reverse | grep -v Merge
printf "\n\n"
fi
previous_tag=${current_tag}
done

0 comments on commit 7f6e667

Please sign in to comment.