Skip to content

Commit

Permalink
Added open tracing java example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Fortuna committed Nov 13, 2020
1 parent b51523a commit 3f22a6e
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 8 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Run make
run: make
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
SHELL:=/bin/bash
AWS_DEFAULT_REGION?=ap-southeast-2

TERRAFORM_VERSION=0.13.4
TERRAFORM=docker run --rm -v "${PWD}:/work" -v "${HOME}:/root" -e AWS_DEFAULT_REGION=$(AWS_DEFAULT_REGION) -e http_proxy=$(http_proxy) --net=host -w /work hashicorp/terraform:$(TERRAFORM_VERSION)

TERRAFORM_DOCS=docker run --rm -v "${PWD}:/work" tmknom/terraform-docs

CHECKOV=docker run --rm -t -v "${PWD}:/work" bridgecrew/checkov
CHECKOV=docker run --rm -v "${PWD}:/work" bridgecrew/checkov

TFSEC=docker run --rm -it -v "${PWD}:/work" liamg/tfsec
TFSEC=docker run --rm -v "${PWD}:/work" liamg/tfsec

DIAGRAMS=docker run -t -v "${PWD}:/work" figurate/diagrams python
DIAGRAMS=docker run -v "${PWD}:/work" figurate/diagrams python

EXAMPLE=$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))

Expand All @@ -17,7 +19,7 @@ EXAMPLE=$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
all: validate test docs format

clean:
rm -rf .terraform/ terraform.tfstate* examples/ical4j/build ical4j.zip
rm -rf .terraform/ terraform.tfstate* examples/ical4j/build ical4j.zip opentracing.zip

validate:
$(TERRAFORM) init && $(TERRAFORM) validate && \
Expand Down Expand Up @@ -50,7 +52,8 @@ format:
$(TERRAFORM) fmt -list=true ./modules/aws-sdk-java && \
$(TERRAFORM) fmt -list=true ./modules/groovy-runtime && \
$(TERRAFORM) fmt -list=true ./modules/python-requests && \
$(TERRAFORM) fmt -list=true ./examples/ical4j
$(TERRAFORM) fmt -list=true ./examples/ical4j && \
$(TERRAFORM) fmt -list=true ./examples/opentracing

example:
$(TERRAFORM) init examples/$(EXAMPLE) && $(TERRAFORM) plan examples/$(EXAMPLE)
$(TERRAFORM) init -upgrade examples/$(EXAMPLE) && $(TERRAFORM) plan examples/$(EXAMPLE)
2 changes: 1 addition & 1 deletion examples/ical4j/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module "build" {
module "lambda_layer" {
source = "../.."

content_path = "${path.root}/build/layer"
content_path = "${module.build.output_dir}/layer"
description = "iCal4j java library"
layer_name = "ical4j"
runtimes = ["java8"]
Expand Down
3 changes: 3 additions & 0 deletions examples/ical4j/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "container_logs" {
value = module.build.container_logs
}
2 changes: 1 addition & 1 deletion examples/ical4j/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
provider "docker" {
host = "tcp://127.0.0.1:2375/"
host = "tcp://127.0.0.1:2376/"
}
18 changes: 18 additions & 0 deletions examples/opentracing/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
compile "io.opentracing:opentracing-util:$openTracingVersion"
}

task copyDeps(type: Copy) {
from configurations.compile
into 'build/layer/java/libs'
}

build.dependsOn copyDeps
1 change: 1 addition & 0 deletions examples/opentracing/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openTracingVersion = 0.33.0
17 changes: 17 additions & 0 deletions examples/opentracing/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module "build" {
source = "figurate/docker-container/docker//modules/gradle"

host_path = abspath(path.root)
}

module "lambda_layer" {
source = "../.."

content_path = "${module.build.output_dir}/layer"
description = "Open Tracing java library"
layer_name = "opentracing"
runtimes = ["java8"]
dry_run = var.dry_run

depends_on = [module.build]
}
3 changes: 3 additions & 0 deletions examples/opentracing/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "container_logs" {
value = module.build.container_logs
}
3 changes: 3 additions & 0 deletions examples/opentracing/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
provider "docker" {
host = "tcp://127.0.0.1:2376/"
}
4 changes: 4 additions & 0 deletions examples/opentracing/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "dry_run" {
description = "Flag to disable lambda layer deployment"
default = true
}
9 changes: 9 additions & 0 deletions examples/opentracing/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_providers {
docker = {
source = "terraform-providers/docker"
version = "~> 2.0"
}
}
required_version = ">= 0.13"
}

0 comments on commit 3f22a6e

Please sign in to comment.