Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
basic circleci build integration (#19)
Browse files Browse the repository at this point in the history
* added basic circleci build

* added wildfly job

* fixed wildfly steps

* fixed wildfly steps (v2)

* added wildfly build dependency

* fixed build job

* fixed build job (v2)

* removed all caching

* added x flag to gradlew

* adapted wildfly command

* added ps aux step

* fixed ps aux

* added nmap

* changed nmap params

* added sleeps; gradle deploy; curl

* start wildfly image manually

* adapted to use circleci machine

* added mgmnt user creation

* added 8080 mapping

* added verify task
  • Loading branch information
Ingwersaft committed Apr 16, 2019
1 parent 24f42de commit 20b2208
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 9 deletions.
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- run: ./gradlew dependencies
- run: ./gradlew build
- run: ./gradlew publishToMavenLocal
wildfly:
machine: true
steps:
- checkout
- run: docker run --name wildfly --rm -d -p 8080:8080 -p 9990:9990 jboss/wildfly:16.0.0.Final /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
- run: sleep 10
- run: docker exec wildfly /opt/jboss/wildfly/bin/add-user.sh mgmt 1234
- run: ps aux
- run: |
./gradlew build publishToMavenLocal
cd integration
./gradlew clean deploy verify --no-build-cache --info && echo "build.id:" && cat build.id && echo && echo "curl:" && curl localhost:8080/integration-1/rest/id && echo
sleep 10
./gradlew
workflows:
version: 2
all:
jobs:
- build
- wildfly:
requires:
- build
Empty file modified gradlew
100644 → 100755
Empty file.
39 changes: 31 additions & 8 deletions integration/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import com.mkring.wildlydeplyplugin.DeployWildflyTask
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.HttpClients
import org.apache.http.util.EntityUtils
import org.gradle.internal.id.UUIDGenerator
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand All @@ -7,6 +10,14 @@ plugins {
id("com.mkring.wildlydeplyplugin.deploy-wildfly-plugin") version "0.2.10"
war
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.apache.httpcomponents:httpclient:4.5.8")
}
}

group = "com.mkring.wildlydeplyplugin"
version = "1"
Expand All @@ -24,18 +35,30 @@ dependencies {
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

task("build-id") {
doFirst {
File("build.id").apply {
createNewFile()
val id = UUIDGenerator().generateId().toString()
println("buildId=$id")
writeText(id)
task("verify") {
doLast {
val fileId = File("build.id").readText()
val apiId =
HttpClients.createDefault().execute(HttpGet("http://localhost:8080/integration-1/rest/id")).entity.let {
EntityUtils.toString(it)
}
println("fileId=$fileId")
println("apiId=$apiId")
if (!fileId.equals(apiId)) {
throw RuntimeException("fileId.equals(apiId) == false!")
}
}
}
task("build-id") {
File("build.id").apply {
createNewFile()
val id = UUIDGenerator().generateId().toString()
println("buildId=$id")
writeText(id)
}
outputs.doNotCacheIf("always generate new id") { true }
}
tasks.findByPath("build")?.outputs?.cacheIf { false }
task("deploy", DeployWildflyTask::class) {
host = "localhost"
port = 9990
Expand Down
Empty file modified integration/gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FileDeployer(
) {

fun deploy() {
log.debug("deploy(): " + this)
log.debug("deploy(): $this")
checkHostDns(host)
checkSocket(host, port)
CLI.newInstance().let { cli ->
Expand Down

0 comments on commit 20b2208

Please sign in to comment.