Skip to content

Commit

Permalink
Updated/4.0.0 (#7)
Browse files Browse the repository at this point in the history
* Delete .comply.yaml

* Godog changed its home

* Fixed godog runner

* Updated godog to v0.10

* Test and build only in the current latest stable go version - 1.14 for now

* Updated deprecated godog api

* Use golangci-lint for code linting

* Fixed code linting issues

* Run linting before tests

* Fixed golangci-lint installation script

* Support dynamic port for deps in integration tests

* Support dynamic port for deps in features tests

* Replace upstreams port in features tests with dynamic value if set

* Testing flow with GH Actions

* Fix resources default value

* remove c-style (incorrect) swtich handling

* Simplified application build

* use pre defined Version field in root cmd

* delete version.go

* update go mod files

* Use ubuntu for docker image and run as nobody

* GH Actions release flow with GoReleaser

* Ignore freebsd/arm64 build as it can not be done

* Updated docker image refs to docker hub

* Go 1.15

* Wrap errors using stdlib

* Updated changelog for new release

* Goreleaser should include all the commits since last release

* Migrate .whitesource configuration file to inheritance mode

* Updated health-go to v3

* Updated redis and limiter libraries

* Use official mongo driver

* Update README.md

* added dockerfile for debugging, fixed bug with strip path not working correctly and added tests

* janus#463 added initial cassandra logic to add definitions

* janus#463 updated opencensus exporter modules

* motiv-labs#463 filled out logic for cassandra oauth plugin. fixed broken queries. got cassandra generally working it seems

* motiv-labs#463 removed motiv-labs module dependencies.

* motiv-labs#465 added basic auth to cassandra

* added hash and salt to store and compare passwords

* janus#463 removed/changed extra logging. added circle config

* janus#463 removed/changed extra logging. added circle config

* added some comments about where to run the dockerfiles from

* updated circle config make command

* updated circle config make command

* updated circle config make command

* updated circle config make command

* updated circle config make command

* motiv-labs#463 updated dockerfile to build image all inside container. updated cirlce config

* motiv-labs#463 reverted changes to mongo example, updated circle config

* Update README.md

* Update README.md

* updated statement execute to have retry logic

* updated statement execute to have retry logic

* updating image in circle (motiv-labs#468)

* Janus#463 cassandra repo (motiv-labs#469)

* updating image in circle

* fixed add user logic

* Janus#463 cassandra repo (motiv-labs#470)

* updating image in circle

* fixed add user logic

* added env var for cassandra cluster consistency

* removed extra debug logging

* updating image

* [skip ci] updated conf file

* #nosmoke flag added

* #nosmoke updated cass env vars

* removed cassandra domain env var since we connect through the dsn in config file

* #nosmoke Add organization plugin (motiv-labs#479)

* added company plugin to janus to pair users with a company

* changed plugin term from company to organization, updated plugin to handle authentication separete from basic auth plugin.

* fixed wrong log type. updated debug entry script to start janus properly

* added page to doc

* go mod tidy

* Dockerfile updated

Co-authored-by: Vladimir Garvardt <[email protected]>
Co-authored-by: Elena Pavlova <[email protected]>
Co-authored-by: Akhil Thayyil <[email protected]>
Co-authored-by: Akhil <[email protected]>
Co-authored-by: Kumar Saurabh <[email protected]>
Co-authored-by: whitesource-for-github-com[bot] <50673670+whitesource-for-github-com[bot]@users.noreply.github.com>
Co-authored-by: Jason Tesser <[email protected]>
Co-authored-by: Aristotle <[email protected]>
  • Loading branch information
9 people authored Feb 17, 2022
1 parent af7a4ce commit 14a007e
Show file tree
Hide file tree
Showing 120 changed files with 4,821 additions and 1,790 deletions.
55 changes: 55 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
jobs:
build_test:
#docker:
# - image: docker/compose:1.25.3

machine:
image: ubuntu-1604:201903-01

steps:
- checkout

# - run:
# name: Running Unit Tests
# command: |
# echo "Running unit tests and building binary"
# go mod download
# make all
- run:
name: Build and Push Images
command: |
echo "Logging in to Docker Hub"
docker login --username ${DOCKERHUB_USERNAME} --password ${DOCKERHUB_PASSWORD}
echo "Setting Image Name"
IMAGE_NAME="motivlabs/janus:$(date +%Y%m%d%H%M%S)-${CIRCLE_SHA1:0:6}"
echo "Image Name"
echo $IMAGE_NAME
echo "Building Service Image"
docker build -f ./Dockerfile --target=prod -t ${IMAGE_NAME} -t motivlabs/janus:latest .
echo "Finished Building Service Image"
echo "Pushing Service Images to Docker Hub"
docker push $IMAGE_NAME
echo "Pushed Extended Image Name"
docker push motivlabs/janus:latest
echo "Pushed Latest Image Name"
COMMIT_MESSAGE=$(git log --format=oneline -n 1 $CIRCLE_SHA1)
echo "got commit message: ${COMMIT_MESSAGE}"
echo "Running Script to Update Impulse Docker-Compose with Correct Image"
.circleci/update-impulse.sh "janus" ${IMAGE_NAME} ${GITHUB_OAUTH} "${COMMIT_MESSAGE}"
echo "Impulse Updated"
workflows:
version: 2
build:
jobs:
- build_test:
context: MotivLabs
filters:
branches:
only:
- master
34 changes: 34 additions & 0 deletions .circleci/update-impulse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# There are 4 arguments passed in.
# $1 is the name of the micro service
# $2 is the image id
# $3 is the GITHUB OAUTH Key
# This script will first get the latest raw of the docker-compose file for impulse and copy it into a local file
# It will then replace the entire name of the image for the passed in ($1) micro service with the image name that is built
# Finally it will commit the new docker-compose file to impulse with a message

set -x
# echo running script
#
# echo getting file from GITHUB
curl -H 'Authorization: token '"$3"'' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/compose-template/config/astro.conf

# echo search and replace
sed -i "s+motivlabs/$1:.*+$2+g" astro.conf
# echo pushing file to GITHUB

if [[ $(echo "$4" | grep -c -i "#nosmoke") == 1 ]]; then
echo "no smoke"
curl -X PUT -H 'Authorization: token '"$3"'' -d '{"message":"[skip ci] updated janus image","content":"'"$(base64 -w0 astro.conf)"'","sha":'"$(curl -s -X GET -H 'Authorization: token '"$3"'' https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/compose-template/config/astro.conf | jq .sha)"'}' -L https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/compose-template/config/astro.conf
else
echo "smoke"
curl -X PUT -H 'Authorization: token '"$3"'' -d '{"message":"updated janus image","content":"'"$(base64 -w0 astro.conf)"'","sha":'"$(curl -s -X GET -H 'Authorization: token '"$3"'' https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/compose-template/config/astro.conf | jq .sha)"'}' -L https://api.github.com/repos/motiv-labs/impulse/contents/docker-tools/compose-template/config/astro.conf
fi

# update googlecloud image
curl -H 'Authorization: token '"$3"'' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/motiv-labs/impulse-googlecloud/contents/impulse/janus-deployment.yaml
sed -i "s+motivlabs/$1:.*+$2+g" janus-deployment.yaml
curl -X PUT -H 'Authorization: token '"$3"'' -d '{"message":"updated janus image","content":"'"$(base64 -w0 janus-deployment.yaml)"'","sha":'"$(curl -s -X GET -H 'Authorization: token '"$3"'' https://api.github.com/repos/motiv-labs/impulse-googlecloud/contents/impulse/janus-deployment.yaml | jq .sha)"'}' -L https://api.github.com/repos/motiv-labs/impulse-googlecloud/contents/impulse/janus-deployment.yaml

# echo finished script
31 changes: 0 additions & 31 deletions .comply.yaml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release

on:
release:
types:
- created

jobs:
goreleaser:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2
- name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/')
env:
DOCKER_USERNAME: hellofreshtech
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74 changes: 74 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Testing

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.30

test:
name: Test
runs-on: ubuntu-latest
needs: [lint]

services:
mongo:
image: mongo:3
ports:
- "27017"
options: >-
--health-cmd "mongo localhost:27017/test --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
upstreams:
image: rodolpheche/wiremock:2.27.0-alpine
ports:
- "8080"

auth_service:
image: rodolpheche/wiremock:2.27.0-alpine
ports:
- "8080"

steps:
- name: Set up Go
uses: actions/setup-go@v2
- name: Check out code
uses: actions/checkout@v2
- name: Run unit tests
if: success()
run: make test-unit
- name: Run integration tests
if: success()
run: make test-integration
env:
DYNAMIC_UPSTREAMS_PORT: ${{ job.services.upstreams.ports[8080] }}
DYNAMIC_AUTH_PORT: ${{ job.services.auth_service.ports[8080] }}
- name: Run features tests
if: success()
run: make test-features
env:
DYNAMIC_MONGO_PORT: ${{ job.services.mongo.ports[27017] }}
DYNAMIC_UPSTREAMS_PORT: ${{ job.services.upstreams.ports[8080] }}
DYNAMIC_AUTH_PORT: ${{ job.services.auth_service.ports[8080] }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: success()
with:
file: ./coverage.txt
fail_ci_if_error: false
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
*.o
*.a
*.so
main

# Folders
_obj
_test
.idea

# Architecture specific extensions/prefixes
*.[568vq]
Expand Down
15 changes: 15 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://golangci-lint.run/usage/configuration/#config-file for more information
run:
timeout: 5m
linters:
disable-all: true
enable:
- gofmt
- golint
- goimports
fast: false
linters-settings:
gofmt:
simplify: false
issues:
exclude-use-default: false
43 changes: 43 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
project_name: janus

builds:
- id: binary-build
main: main.go
binary: janus
ldflags:
- -s -w -X main.version={{.Version}}
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
- freebsd
- openbsd
goarch:
- amd64
- arm
- arm64
- 386
ignore:
- goos: darwin
goarch: 386
- goos: freebsd
goarch: arm64

dockers:
- goos: linux
goarch: amd64
binaries:
- janus
image_templates:
- "hellofreshtech/janus:latest"
- "hellofreshtech/janus:{{.Tag}}"
dockerfile: Dockerfile

changelog:
sort: asc
filters:
exclude:
- Merge pull request
- Merge branch
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"settingsInheritedFrom": "hellofresh/whitesource-config@master"
}
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Unreleased

- None

--

# 4.0.0

## Changed
- Official docker image moved to [Docker Hub](https://hub.docker.com/repository/docker/hellofreshtech/janus) and can be pulled with `docker pull hellofreshtech/janus`
- Test and release flow uses the latest stable Go version

# 3.8.19

## Added
Expand Down
Loading

0 comments on commit 14a007e

Please sign in to comment.