Skip to content

Commit daa6835

Browse files
authored
Bump packages (#19)
1 parent 42b70e0 commit daa6835

File tree

5,356 files changed

+1000
-1704163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,356 files changed

+1000
-1704163
lines changed

.github/workflows/ci.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2019 Iguazio
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
name: CI
16+
17+
on:
18+
pull_request:
19+
branches:
20+
- development
21+
- '[0-9]+.[0-9]+.x'
22+
23+
push:
24+
branches:
25+
- development
26+
- master
27+
28+
jobs:
29+
lint:
30+
name: Lint
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- uses: actions/setup-go@v3
36+
with:
37+
cache: true
38+
go-version-file: "go.mod"
39+
40+
- name: Run lint
41+
run: make lint
42+
43+
build:
44+
name: Build
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v3
48+
49+
- name: Run build
50+
run: make build

.github/workflows/release.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2019 Iguazio
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
name: Release
16+
17+
on:
18+
release:
19+
types:
20+
- created
21+
22+
# Run Release on push to development for unstable
23+
push:
24+
branches:
25+
- development
26+
27+
jobs:
28+
release:
29+
name: Release Docker Images
30+
runs-on: ubuntu-latest
31+
steps:
32+
33+
- name: Set unstable
34+
if: github.event_name == 'push'
35+
run: |
36+
echo "LABEL=unstable" >> $GITHUB_ENV
37+
38+
- name: Set release
39+
if: github.event_name == 'release'
40+
run: |
41+
echo "LABEL=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
42+
cat $GITHUB_ENV
43+
44+
- uses: actions/checkout@v3
45+
46+
- name: Login to GCR
47+
run: |
48+
echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin https://gcr.io
49+
env:
50+
GCR_JSON_KEY: ${{ secrets.GCR_IGUAZIO_JSON_KEY }}
51+
52+
- name: Build image
53+
run: make build
54+
55+
- name: Push image
56+
run: make push

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
13+
14+
.vscode
15+
.idea
16+
.github/.act
17+
.bin

.travis.yml

-17
This file was deleted.

Dockerfile

-20
This file was deleted.

Jenkinsfile

-45
This file was deleted.

Makefile

+33-57
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,42 @@
1-
LOCATOR_PATH ?= src/github.com/v3io/locator
2-
LOCATOR_TAG ?= latest
3-
LOCATOR_REPOSITORY ?= v3io/
4-
LOCATOR_BUILD_COMMAND ?= CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags="-s -w" -o $(GOPATH)/bin/locatorctl $(GOPATH)/$(LOCATOR_PATH)/cmd/locatorctl/main.go
5-
6-
.PHONY: all
7-
all: lint build
8-
@echo Done.
1+
# Copyright 2019 Iguazio
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
LABEL ?= unstable
17+
REPOSITORY ?= gcr.io/iguazio
18+
IMAGE = $(REPOSITORY)/locator:$(LABEL)
919

1020
.PHONY: build
1121
build:
12-
docker build --tag=$(LOCATOR_REPOSITORY)locator:$(LOCATOR_TAG) .
13-
14-
.PHONY: ensure-gopath bin
15-
bin:
16-
$(LOCATOR_BUILD_COMMAND)
22+
@docker build \
23+
--file cmd/locator/Dockerfile \
24+
--tag=$(IMAGE) \
25+
.
1726

18-
.PHONY: ensure-gopath lint
19-
lint: ensure-gopath
20-
@echo $(GOPATH)
21-
@echo Installing linters...
22-
go get -u gopkg.in/alecthomas/gometalinter.v2
23-
@$(GOPATH)/bin/gometalinter.v2 --install
27+
.PHONY: push
28+
push:
29+
docker push $(IMAGE)
2430

25-
@echo Linting...
26-
@$(GOPATH)/bin/gometalinter.v2 \
27-
--deadline=300s \
28-
--disable-all \
29-
--enable-gc \
30-
--enable=deadcode \
31-
--enable=goconst \
32-
--enable=gofmt \
33-
--enable=golint \
34-
--enable=gosimple \
35-
--enable=ineffassign \
36-
--enable=interfacer \
37-
--enable=misspell \
38-
--enable=staticcheck \
39-
--enable=unconvert \
40-
--enable=varcheck \
41-
--enable=vet \
42-
--enable=vetshadow \
43-
--enable=errcheck \
44-
--exclude="_test.go" \
45-
--exclude="comment on" \
46-
--exclude="error should be the last" \
47-
--exclude="should have comment" \
48-
./cmd/... ./pkg/...
31+
.PHONY: lint
32+
lint:
33+
./hack/lint/install.sh
34+
./hack/lint/run.sh
4935

50-
@echo Done.
51-
52-
.PHONY: vet
53-
vet:
54-
go vet ./cmd/...
55-
go vet ./pkg/...
36+
.PHONY: fmt
37+
fmt:
38+
@go fmt $(shell go list ./... | grep -v /vendor/)
5639

5740
.PHONY: test
5841
test:
59-
go test -v ./cmd/...
60-
go test -v ./pkg/...
61-
62-
.PHONY: ensure-gopath
63-
ensure-gopath:
64-
ifndef GOPATH
65-
$(error GOPATH must be set)
66-
endif
42+
go test -p1 -v ./pkg/...

cmd/locator/Dockerfile

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2019 Iguazio
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
FROM gcr.io/iguazio/golang:1.19 as builder
16+
17+
# copy source tree
18+
WORKDIR /app
19+
20+
COPY go.mod go.sum ./
21+
22+
RUN go mod download
23+
24+
COPY . .
25+
26+
# build the app
27+
RUN GOOS=linux \
28+
GOARCH=amd64 \
29+
CGO_ENABLED=0 \
30+
go build -a -installsuffix cgo -ldflags="-s -w" -o locatorctl cmd/locator/main.go
31+
32+
#
33+
# Output stage: Copies binary to an alpine based image
34+
#
35+
36+
FROM debian:stretch-slim
37+
38+
RUN apt-get update && \
39+
apt-get install -y --no-install-recommends ca-certificates && \
40+
apt-get clean && \
41+
rm -rf /var/lib/apt/lists/*
42+
43+
# copy app binary from build stage
44+
COPY --from=builder /app/locatorctl /usr/local/bin
45+
46+
CMD [ "locatorctl" ]
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
// Copyright 2015 The Prometheus Authors
1+
// Copyright 2019 Iguazio
2+
//
23
// Licensed under the Apache License, Version 2.0 (the "License");
34
// you may not use this file except in compliance with the License.
45
// You may obtain a copy of the License at
56
//
6-
// http://www.apache.org/licenses/LICENSE-2.0
7+
// http://www.apache.org/licenses/LICENSE-2.0
78
//
89
// Unless required by applicable law or agreed to in writing, software
910
// distributed under the License is distributed on an "AS IS" BASIS,
1011
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1112
// See the License for the specific language governing permissions and
1213
// limitations under the License.
1314

14-
// A minimal example of how to include Prometheus instrumentation.
1515
package main
1616

1717
import (
1818
"flag"
19-
"log"
20-
"net/http"
19+
"fmt"
2120

22-
"github.com/prometheus/client_golang/prometheus/promhttp"
21+
"github.com/v3io/locator/pkg/locator"
2322
)
2423

25-
var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.")
26-
2724
func main() {
25+
config := &locator.Config{}
26+
flag.IntVar(&config.Port, "port", 8080, "Listen port (default: 8080)")
27+
flag.StringVar(&config.Namespace, "namespace", "", "Namespace to monitor")
2828
flag.Parse()
29-
http.Handle("/metrics", promhttp.Handler())
30-
log.Fatal(http.ListenAndServe(*addr, nil))
29+
30+
if err := locator.RunServer(config); err != nil {
31+
fmt.Println("Error while serving registry", err)
32+
}
3133
}

0 commit comments

Comments
 (0)