-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
250 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
sudo: false | ||
|
||
services: | ||
- docker | ||
|
||
#env: | ||
# global: | ||
# # DOCKER_USER | ||
# - secure: | ||
# # DOCKER_PASS | ||
# - secure: | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
before_install: | ||
- make init | ||
|
||
script: | ||
- make verify | ||
|
||
before_deploy: | ||
- make docker-build docker-images | ||
|
||
deploy: | ||
- provider: script | ||
skip_cleanup: true | ||
script: | ||
- make -e docker-login docker-push | ||
on: | ||
repo: VirtusLab/runscope-agent | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM alpine:3.9 | ||
|
||
ENV ARCHIVE_NAME="runscope-radar.zip" \ | ||
BIN_DIRECTORY="/home/agent/bin" \ | ||
USER="agent" \ | ||
AGENT_UID="472" \ | ||
AGENT_GID="472" | ||
|
||
RUN set -x && apk --no-cache add --update ca-certificates && \ | ||
addgroup -g "${AGENT_GID}" -S "${USER}" && \ | ||
adduser -u "${AGENT_UID}" -S "${USER}" -G "${USER}" && \ | ||
mkdir -p "${BIN_DIRECTORY}" && \ | ||
wget "https://s3.amazonaws.com/runscope-downloads/runscope-radar/latest/linux-386/${ARCHIVE_NAME}" && \ | ||
unzip "${ARCHIVE_NAME}" -d "${BIN_DIRECTORY}" && rm "${ARCHIVE_NAME}" && \ | ||
chown -R "${USER}:${USER}" "${BIN_DIRECTORY}" | ||
|
||
USER "${USER}" | ||
ENTRYPOINT [ "/home/agent/bin/runscope-radar" ] | ||
CMD ["--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# Setup variables for the Makefile | ||
NAME=runscope-agent | ||
REPO=virtuslab/runscope-agent | ||
DOCKER_REGISTRY=quay.io | ||
|
||
# Set POSIX sh for maximum interoperability | ||
SHELL := /bin/sh | ||
PATH := $(GOPATH)/bin:$(PATH) | ||
|
||
# Set an output prefix, which is the local directory if not specified | ||
PREFIX?=$(shell pwd) | ||
|
||
# Populate version variables | ||
# Add to compile time flags | ||
VERSION := $(shell cat VERSION.txt) | ||
GITCOMMIT := $(shell git rev-parse --short HEAD) | ||
GITBRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no) | ||
GITIGNOREDBUTTRACKEDCHANGES := $(shell git ls-files -i --exclude-standard) | ||
ifneq ($(GITUNTRACKEDCHANGES),) | ||
GITCOMMIT := $(GITCOMMIT)-dirty | ||
endif | ||
ifneq ($(GITIGNOREDBUTTRACKEDCHANGES),) | ||
GITCOMMIT := $(GITCOMMIT)-dirty | ||
endif | ||
|
||
VERSION_TAG := $(VERSION)-$(GITCOMMIT) | ||
LATEST_TAG := latest | ||
|
||
ARGS ?= $(EXTRA_ARGS) | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: all | ||
all: clean init verify docker-build ## Ensure deps, test, verify, docker build | ||
@echo "+ $@" | ||
|
||
.PHONY: init | ||
init: ## Initializes this Makefile dependencies: checkmake | ||
@echo "+ $@" | ||
go get -u github.com/mrtazz/checkmake | ||
|
||
.PHONY: verify | ||
verify: checkmake ## Runs a checkmake | ||
|
||
.PHONY: clean | ||
clean: ## Cleanup | ||
@echo "+ $@" | ||
|
||
.PHONY: spring-clean | ||
spring-clean: ## Cleanup git ignored files (interactive) | ||
@echo "+ $@" | ||
git clean -Xdi | ||
|
||
.PHONY: test | ||
test: ## Runs the go tests | ||
@echo "+ $@" | ||
|
||
.PHONY: docker-build | ||
docker-build: ## Build the container | ||
@echo "+ $@" | ||
docker build -t $(REPO):$(GITCOMMIT) . | ||
|
||
.PHONY: docker-login | ||
docker-login: ## Log in into the repository | ||
@echo "+ $@" | ||
@docker login -u="${DOCKER_USER}" -p="${DOCKER_PASS}" $(DOCKER_REGISTRY) | ||
|
||
.PHONY: docker-images | ||
docker-images: ## List all local containers | ||
@echo "+ $@" | ||
@docker images | ||
|
||
.PHONY: docker-push | ||
docker-push: docker-login ## Push the container | ||
@echo "+ $@" | ||
@docker tag $(REPO):$(GITCOMMIT) $(DOCKER_REGISTRY)/$(REPO):$(VERSION) | ||
@docker tag $(REPO):$(GITCOMMIT) $(DOCKER_REGISTRY)/$(REPO):$(VERSION_TAG) | ||
@docker tag $(REPO):$(GITCOMMIT) $(DOCKER_REGISTRY)/$(REPO):$(LATEST_TAG) | ||
@docker push $(DOCKER_REGISTRY)/$(REPO):$(VERSION) | ||
@docker push $(DOCKER_REGISTRY)/$(REPO):$(VERSION_TAG) | ||
@docker push $(DOCKER_REGISTRY)/$(REPO):$(LATEST_TAG) | ||
|
||
.PHONY: docker-run | ||
docker-run: docker-build ## Build and run the container | ||
@echo "+ $@" | ||
docker run -i -t -v $(PWD):/host \ | ||
$(REPO):$(GITCOMMIT) --help | ||
|
||
.PHONY: bump-version | ||
BUMP := patch | ||
bump-version: ## Bump the version in the version file. Set BUMP to [ patch | major | minor ] | ||
@echo "+ $@" | ||
go get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
$(eval NEW_VERSION=$(shell sembump --kind $(BUMP) $(VERSION))) | ||
@echo "Bumping VERSION.txt from $(VERSION) to $(NEW_VERSION)" | ||
echo $(NEW_VERSION) > VERSION.txt | ||
@echo "Updating version from $(VERSION) to $(NEW_VERSION) in README.md" | ||
sed -i s/$(VERSION)/$(NEW_VERSION)/g README.md | ||
git add VERSION.txt README.md | ||
git commit -vseam "Bump version to $(NEW_VERSION)" | ||
@echo "Run make tag to create and push the tag for new version $(NEW_VERSION)" | ||
|
||
.PHONY: tag | ||
tag: ## Create a new git tag to prepare to build a release | ||
@echo "+ $@" | ||
git tag -s -a $(VERSION) -m "$(VERSION)" | ||
git push origin $(VERSION) | ||
|
||
.PHONY: help | ||
help: | ||
@grep -Eh '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: checkmake | ||
checkmake: ## Check this Makefile | ||
@echo "+ $@" | ||
@checkmake Makefile | ||
|
||
.PHONY: status | ||
status: ## Shows git and dep status | ||
@echo "+ $@" | ||
@echo "Commit: $(GITCOMMIT), VERSION: $(VERSION)" | ||
@echo | ||
ifneq ($(GITUNTRACKEDCHANGES),) | ||
@echo "Changed files:" | ||
@git status --porcelain --untracked-files=no | ||
@echo | ||
endif | ||
ifneq ($(GITIGNOREDBUTTRACKEDCHANGES),) | ||
@echo "Ignored but tracked files:" | ||
@git ls-files -i --exclude-standard | ||
@echo | ||
endif | ||
@echo "Dependencies:" | ||
@dep status | ||
@echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# runscope-agent | ||
|
||
A Docker image for running the [runscope agent](https://www.runscope.com/docs/radar/agent). | ||
|
||
[![Version](https://img.shields.io/badge/version-v0.0.1-brightgreen.svg)](https://github.com/VirtusLab/runscope-agent/releases/tag/v0.0.1) | ||
[![Build Status](https://travis-ci.org/VirtusLab/runscope-agent.svg?branch=master)](https://travis-ci.org/VirtusLab/runscope-agent) | ||
[![Docker Repository on Quay](https://quay.io/repository/VirtusLab/runscope-agent/status "Docker Repository on Quay")](https://quay.io/repository/VirtusLab/runscope-agent) | ||
|
||
## Using the docker image | ||
|
||
```bash | ||
docker run --rm quay.io/virtuslab/runscope-agent --help | ||
Usage of radar: | ||
--agent-id string | ||
Agent uuid | ||
--api-host string | ||
Api host base url | ||
--cafile string | ||
CA certificate file | ||
-f, --configfile string | ||
Config file | ||
--debug | ||
Enable debugging web server | ||
--disconnect-timeout string | ||
Disconnect timeout (default "5") | ||
--ignore-env-proxy | ||
Ignore HTTP_PROXY and HTTPS_PROXY environment variables | ||
-l, --logfile string | ||
Logfile to write to | ||
--name string | ||
Agent name | ||
--pidfile string | ||
Pid file | ||
--team-id string | ||
team uuid | ||
-w, --threads int | ||
Number of worker threads (default 10) | ||
--timeout int | ||
Connection idle timeout (default 20) | ||
-t, --token string | ||
Runscope Auth Token | ||
-v, --verbose | ||
Log more information | ||
--verify-ssl string | ||
Verify SSL? (true/false) (default "true") | ||
--version | ||
Get version number | ||
--web-host string | ||
Web host base url (default "https://www.runscope.com") | ||
``` | ||
## Contribution | ||
|
||
Feel free to file [issues](https://github.com/VirtusLab/runscope-agent/issues) | ||
or [pull requests](https://github.com/VirtusLab/runscope-agent/pulls). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Setup variables for the Makefile | ||
NAME=runscope-agent | ||
REPO=runscope-agent | ||
DOCKER_REGISTRY=914904879356.dkr.ecr.eu-west-1.amazonaws.com | ||
CLAIR_ADDR=http://api.clair.svc.cluster.local | ||
AWS_ACCOUNT=914904879356 | ||
AWS_REGION=eu-west-1 |