Skip to content
/ API Public

The Backend API for the CodeMC Jenkins and Nexus Services

License

Notifications You must be signed in to change notification settings

CodeMC/API

Repository files navigation

CodeMC API

This is the official API for CodeMC Jenkins and Nexus services. It is used by the Discord Bot to do various tasks as a part of our service to our users.

Installation

GitHub branch checks state GitHub GitHub issues

Maven
<project>
    
    <!-- Import CodeMC Repo -->
    
    <repositories>
        <repository>
            <id>codemc-public</id>
            <url>https://repo.codemc.io/repository/maven-public/</url>
        </repository>
    </repositories>
    
    <dependencies>
        <dependency>
          <groupId>io.codemc.api</groupId>
          <artifactId>codemc-api</artifactId>
          <version>[VERSION]</version>
        </dependency>
    </dependencies>
    
</project>
Gradle (Groovy)
repositories {
    maven { url 'https://repo.codemc.io/repository/maven-public/' }
}

dependencies {
    implementation 'io.codemc.api:codemc-api:[VERSION]'
}
Gradle (Kotlin DSL)
repositories {
    maven(url = "https://repo.codemc.io/repository/maven-public/")
}

dependencies {
    implementation("io.codemc.api:codemc-api:[VERSION]")
}

Local Testing

Test suites rely on both an active services, such as Nexus and Jenkins instances. Luckily, the project comes with Docker files to set these up yourself.

Without the services, some test suites will fail.

Test Script (preferred)

A bash script is provided to build the containers and run the tests. This is the easiest way to test the project.

Requires Docker to be installed.

bash .github/test.sh

Test the project by using Act, a GitHub Action emulator. This will set up and test everything for you.

act push -j 'test'

Manual

First, build and run both containers:

# MariaDB
docker build -t codemc/mariadb src/test/docker/mariadb
docker run -d -p 3306:3306 --name mariadb codemc/mariadb

# Jenkins
docker build -t codemc/jenkins src/test/docker/jenkins
docker run -d -p 8080:8080 --name jenkins-rest codemc/jenkins

# Nexus
docker build -t codemc/nexus src/test/docker/nexus
docker run -d -p 8081:8081 --name nexus-rest codemc/nexus

Before running, copy over the admin.password file into the /tmp/ folder so that the API can log in to the newly created Nexus instance.

docker cp nexus-rest:/nexus-data/admin.password /tmp/admin.password

Then, run the tests:

./gradlew test