Skip to content

Commit

Permalink
fix: rebootstrap cli (#191)
Browse files Browse the repository at this point in the history
* fix: rebootstrap cli

* fix linters
  • Loading branch information
george-e-shaw-iv authored May 4, 2022
1 parent 97cf785 commit 7229dd5
Show file tree
Hide file tree
Showing 35 changed files with 1,459 additions and 1,191 deletions.
28 changes: 27 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2.1
orbs:
shared: getoutreach/shared@1.49.6
shared: getoutreach/shared@1.60.0

# DEPRECATED: Use the devbase orb instead:
# https://github.com/getoutreach/devbase/tree/main/orbs/shared
Expand Down Expand Up @@ -29,6 +29,8 @@ jobs:
auth:
username: _json_key
password: $GCLOUD_SERVICE_ACCOUNT
###Block(customContainers)
###EndBlock(customContainers)
environment:
###Block(testEnvVars)
###EndBlock(testEnvVars)
Expand All @@ -48,10 +50,26 @@ jobs:
- shared/save_go_cache # We save at the end because binaries are included with this
- shared/upload_test_results # Uploads to CircleCI

finalize-coverage:
executor:
name: shared/testbed-docker
docker:
- image: gcr.io/outreach-docker/bootstrap/ci:stable
auth:
username: _json_key
password: $GCLOUD_SERVICE_ACCOUNT
steps:
- shared/setup_environment
- run:
name: Finish Coveralls upload
command: ./scripts/shell-wrapper.sh ci/testing/coveralls-finish.sh

release-dryrun:
executor:
name: shared/testbed-docker
docker_tag: stable
###Block(releaseDryRun)
###EndBlock(releaseDryRun)
steps:
- shared/setup_environment
- shared/with_node_cache:
Expand All @@ -63,6 +81,8 @@ jobs:
executor:
name: shared/testbed-docker
docker_tag: stable
###Block(release)
###EndBlock(release)
steps:
- shared/setup_environment
- shared/with_node_cache:
Expand Down Expand Up @@ -133,3 +153,9 @@ workflows:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- finalize-coverage:
context:
- docker-registry
- ghaccesstoken
requires:
- test
11 changes: 0 additions & 11 deletions .clang-format

This file was deleted.

7 changes: 2 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ root = true
end_of_line = lf
insert_final_newline = true

[Makefile]
[*.go,Makefile]
indent_style = tab

[*.go]
indent_style = tab
indent_size = 2

[*.{bash,rb,sh,slim,yml,yaml}]
indent_style = space
indent_size = 2

###Block(editorconfig)

###EndBlock(editorconfig)
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
* @getoutreach/fnd-dtss

###Block(customCodeowners)

###EndBlock(customCodeowners)
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ updates:
interval: "daily"
# Bootstrap managed dependencies
ignore:
- dependency-name: github.com/getoutreach/mint
- dependency-name: github.com/getoutreach/gobox
- dependency-name: github.com/getoutreach/httpx
- dependency-name: github.com/getoutreach/services
- dependency-name: github.com/getoutreach/datastores/v2
- dependency-name: github.com/urfave/cli/v2

# Ignore semantic-release, this code is only executed in CI.
Expand Down
12 changes: 6 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<!--
!!!! README !!!! Please fill this out.
Please follow the PR naming conventions:
Please follow the PR naming conventions:
https://outreach-io.atlassian.net/wiki/spaces/EN/pages/1902444645/Conventional+Commits
-->


<!-- A short description of what your PR does and what it solves. -->
## What this PR does / why we need it


## What this PR does / why we need it

<!--- Block(jiraPrefix) --->

## Jira ID

[XX-XX]

<!--- EndBlock(jiraPrefix) --->

<!-- Notes that may be helpful for anyone reviewing this PR -->
## Notes for your reviewers


## Notes for your reviewers

<!--- Block(custom) -->

<!--- EndBlock(custom) -->
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
*.so
*.dylib

# Editors (please update any new editor files in
# https://github.com/getoutreach/bootstrap/edit/master/pkg/codegen/templates/.gitignore.tpl
# so every updated project gets it)
# Editor files
*.swp
*~
\#*\#
Expand Down Expand Up @@ -63,4 +61,5 @@ Pulumi.*.yaml
/apidocs

###Block(extras)

###EndBlock(extras)
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
# Documentation for this file: http://goreleaser.com
before:
hooks:
- make dep
Expand All @@ -16,6 +15,7 @@ builds:
ldflags:
- '-w -s -X "github.com/getoutreach/gobox/pkg/app.Version=v{{ .Version }}"'
- '-X "main.HoneycombTracingKey={{ .Env.HONEYCOMB_APIKEY }}"'
- '-X "main.TeleforkAPIKey={{ .Env.TELEFORK_APIKEY }}"'
env:
- CGO_ENABLED=0
archives: []
Expand Down
4 changes: 1 addition & 3 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
preset: conventionalcommits
branches:
- name: master
- name: main
plugins:
- - "@semantic-release/commit-analyzer"
Expand All @@ -11,8 +10,7 @@ plugins:
release: patch
# Block major version upgrades due to us not supporting them that well. This can
# be disabled by setting releaseOptions.allowMajorVersions, but be warned this
# is not well supported for services. Please talk to #dev-tooling-support before
# doing this to save yourself from issues.
# is not well supported for services.
- - "@semantic-release/exec"
# We use generateNotesCmd instead of verifyConditionsCmd because it has access
# to last/nextRelease due to when the step runs.
Expand Down
10 changes: 4 additions & 6 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
golang 1.17.5
# This file contains tool versions for use with asdf
golang 1.17.9
nodejs 16.13.0
terraform 0.13.5
protoc 3.19.1
ruby 2.6.6
# Note: This version of node is just for bootstrap tooling
# not for actual usage of node clients (if they exist) for
# this service.
nodejs 16.13.0
protoc 3.19.1
# Note: Versions in this block override the above. Be EXTREMELY
# CAREFUL with this. If you override a standard version you are
# reducing compatibility guarantees.
Expand Down
23 changes: 14 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@

# localizer

<!--- Block(customGeneralInformation) -->

<!--- EndBlock(customGeneralInformation) -->

## Prerequisites

<!-- Block(customPrerequisites) -->
<!-- EndBlock(customPrerequisites) -->
<!--- Block(customPrerequisites) -->

<!--- EndBlock(customPrerequisites) -->

## Building and Testing

<!-- Block(customBuildingAndTesting) -->
<!-- EndBlock(customBuildingAndTesting) -->
### Replacing a Remote Version of the Library with Local Version
<!--- Block(customBuildingAndTesting) -->

<!--- EndBlock(customBuildingAndTesting) -->

If you want to test the library exposed in this repository in a project that uses it, you can
### Replacing a Remote Version of the a Package with Local Version

_This is only applicable if this repository exposes a public package_.

If you want to test a package exposed in this repository in a project that uses it, you can
add the following `replace` directive to that project's `go.mod` file:

```
replace github.com/getoutreach/localizer => /path/to/local/version/localizer
```

**_Note_**: This library may have postfixed it's module path with a version, go check the first
**_Note_**: This repository may have postfixed it's module path with a version, go check the first
line of the `go.mod` file in this repository to see if that is the case. If that is the case,
you will need to modify the first part of the replace directive (the part before the `=>`) with
that postfixed path.
Expand All @@ -33,4 +38,4 @@ You can run the the linters and unit tests with:

```bash
make test
```
```
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
APP := localizer
OSS := true
_ := $(shell ./scripts/bootstrap-lib.sh)
_ := $(shell ./scripts/devbase.sh)

include .bootstrap/root/Makefile

###Block(targets)

###EndBlock(targets)
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

# localizer

[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white)](https://pkg.go.dev/github.com/getoutreach/localizer)
[![Generated via Bootstrap](https://img.shields.io/badge/Outreach-Bootstrap-%235951ff)](https://github.com/getoutreach/bootstrap)
[![Coverage Status](https://coveralls.io/repos/github/getoutreach/localizer/badge.svg?branch=main)](https://coveralls.io/github//getoutreach/localizer?branch=main)

A no-frills local development approach for Kubernetes powered Developer Environments.

Expand All @@ -12,6 +13,7 @@ Please read the [CONTRIBUTING.md](CONTRIBUTING.md) document for guidelines on de
## High-level Overview

<!--- Block(overview) -->

Tools such as; Telepresence, Skaffold, and others all attempt to solve the problem of getting users
used to using Kubernetes. This is a pretty big task given that Kubernetes has a gigantic surface
area. From my experience (**keyword**: _my experience_), developers have no interest in what
Expand All @@ -21,10 +23,10 @@ a tool that requires no configuration, and is self-explanatory. Which these tool

Given the above, localizer attempts to solve this problem with a few rules:

* A kubernetes cluster should be able to be run locally, but applications should be accessible as if
they were running "locally" (**Note**: Only on Linux do containers _actually_ run locally, the rest are VMs pretending)
* There should be little-to-no DSL to interact with services running in Kubernetes locally.
* No assurances of code working locally will just "work" in Kubernetes. (Let's face it, what you're running locally will never match your production clusters 100%, and if we need to test Kubernetes manifests/etc we should be deploying things into our local cluster and be used to debugging whatever way you do that).
- A kubernetes cluster should be able to be run locally, but applications should be accessible as if
they were running "locally" (**Note**: Only on Linux do containers _actually_ run locally, the rest are VMs pretending)
- There should be little-to-no DSL to interact with services running in Kubernetes locally.
- No assurances of code working locally will just "work" in Kubernetes. (Let's face it, what you're running locally will never match your production clusters 100%, and if we need to test Kubernetes manifests/etc we should be deploying things into our local cluster and be used to debugging whatever way you do that).

## What does `localizer` actually do?

Expand All @@ -49,6 +51,7 @@ allowing remote resources to access your local machine as if they were also runn
## Install `localizer`

You can install the (OSX/LINUX) binary directly into /usr/local/bin:

```
$ curl -Ls https://github.com/getoutreach/localizer/releases/download/v1.9.0/localizer_1.9.0_$(uname)_amd64.tar.gz | tar -xzC /usr/local/bin localizer
```
Expand Down
32 changes: 14 additions & 18 deletions api/v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package api.v1;
option go_package = "github.com/getoutreach/localizer/api";

message ExposeServiceRequest {
string namespace = 1;
string service = 2;
string namespace = 1;
string service = 2;
repeated string port_map = 3;
}

Expand All @@ -29,14 +29,14 @@ message PingRequest {}

message StopExposeRequest {
string namespace = 1;
string service = 2;
string service = 2;
}

enum ConsoleLevel {
CONSOLE_LEVEL_UNSPECIFIED = 0;
CONSOLE_LEVEL_INFO = 1;
CONSOLE_LEVEL_WARN = 2;
CONSOLE_LEVEL_ERROR = 3;
CONSOLE_LEVEL_INFO = 1;
CONSOLE_LEVEL_WARN = 2;
CONSOLE_LEVEL_ERROR = 3;
}

// This will be turned into ConsoleResponse to be generic probably some
Expand All @@ -52,24 +52,20 @@ message ConsoleResponse {
message PingResponse {}

message ListService {
string namespace = 1;
string name = 2;
string status = 3;
string endpoint = 4;
string status_reason = 5;
string ip = 6;
string namespace = 1;
string name = 2;
string status = 3;
string endpoint = 4;
string status_reason = 5;
string ip = 6;
repeated string ports = 7;
}

message ListResponse {
repeated ListService services = 1;
}
message ListResponse { repeated ListService services = 1; }

message Empty {}

message StableResponse {
bool stable = 1;
}
message StableResponse { bool stable = 1; }

service LocalizerService {
rpc ExposeService(ExposeServiceRequest) returns (stream ConsoleResponse) {}
Expand Down
6 changes: 3 additions & 3 deletions bootstrap.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/localizer/expose.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func NewExposeCommand(log logrus.FieldLogger) *cli.Command { //nolint:funlen

for {
res, err := stream.Recv()
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
} else if err != nil {
return err
Expand Down
Loading

0 comments on commit 7229dd5

Please sign in to comment.