Skip to content

Commit 3951cae

Browse files
author
Andrey Klimentyev
authored
Improvements (deckhouse#48)
A round of improvements
1 parent 5a260d0 commit 3951cae

File tree

21 files changed

+287
-111
lines changed

21 files changed

+287
-111
lines changed

.github/workflows/chart.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: chart
2+
3+
env:
4+
CHARTMUSEUM_URL: "https://charts.flant.com/api/common/github/charts"
5+
CHART_DIR: "helm/charts/k8s-image-availability-exporter"
6+
7+
on:
8+
push:
9+
tags:
10+
- v*
11+
branches:
12+
- master
13+
pull_request:
14+
branches:
15+
- master
16+
17+
defaults:
18+
run:
19+
shell: "bash -l -eo pipefail {0}"
20+
21+
jobs:
22+
tests:
23+
runs-on: "ubuntu-20.04"
24+
steps:
25+
- uses: "actions/checkout@v2"
26+
- uses: werf/actions/[email protected]
27+
- name: Werf lint chart
28+
run: cd "$CHART_DIR" && werf helm lint
29+
- name: Werf render chart
30+
run: cd "$CHART_DIR" && werf helm template .
31+
publish-charts:
32+
runs-on: "ubuntu-20.04"
33+
if: "github.event_name == 'push' && github.ref == 'refs/heads/master'"
34+
needs: tests
35+
steps:
36+
- uses: "actions/checkout@v2"
37+
- uses: werf/actions/[email protected]
38+
- name: Package werf charts
39+
run: |
40+
mkdir -p .packages
41+
werf helm package "$CHART_DIR" -d .packages
42+
- name: Publish packaged werf charts
43+
run: |
44+
while read package; do
45+
curl -sSL --post301 --data-binary "@.packages/$package" --user "${{ secrets.CHARTMUSEUM_BASIC_AUTH_USER }}:${{ secrets.CHARTMUSEUM_BASIC_AUTH_PASS }}" "$CHARTMUSEUM_URL"
46+
done < <(find .packages -mindepth 1 -maxdepth 1 -type f -name '*.tgz' -exec sh -c 'basename "$0"' '{}' \;)

.github/workflows/ci.yml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,56 @@ name: CI
22
on:
33
push:
44
tags:
5-
- v*
5+
- v*
66
branches:
7-
- master
7+
- master
88
pull_request:
99
branches:
10-
- master
10+
- master
1111
env:
1212
REGISTRY: registry-write.deckhouse.io
1313
IMAGE_NAME: k8s-image-availability-exporter/k8s-image-availability-exporter
1414
jobs:
15-
lint:
15+
test:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
19-
# https://github.com/golangci/golangci-lint-action
20-
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v2
22-
with:
23-
version: v1.42
24-
args: --timeout=5m
18+
- uses: actions/setup-go@v2
19+
with:
20+
go-version: '1.18'
21+
22+
- id: go-cache-paths
23+
run: |
24+
echo "::set-output name=go-build::$(go env GOCACHE)"
25+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
26+
27+
- name: Go Build Cache
28+
uses: actions/cache@v2
29+
with:
30+
path: ${{ steps.go-cache-paths.outputs.go-build }}
31+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
32+
33+
- name: Go Mod Cache
34+
uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
37+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
38+
39+
- uses: actions/checkout@v2
40+
41+
- name: Test With Coverage
42+
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@v2
45+
with:
46+
files: coverage.txt
47+
48+
- name: golangci-lint
49+
uses: golangci/golangci-lint-action@v2
50+
with:
51+
args: --timeout=5m
2552
build:
2653
runs-on: ubuntu-latest
54+
needs: test
2755
permissions:
2856
contents: read
2957
packages: write
@@ -53,4 +81,4 @@ jobs:
5381
context: .
5482
push: ${{ github.event_name != 'pull_request' }}
5583
tags: ${{ steps.meta.outputs.tags }}
56-
labels: ${{ steps.meta.outputs.labels }}
84+
labels: ${{ steps.meta.outputs.labels }}

go.mod

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/flant/k8s-image-availability-exporter
22

3-
go 1.16
3+
go 1.18
44

55
require (
66
github.com/gammazero/deque v0.1.0
@@ -16,6 +16,52 @@ require (
1616
sigs.k8s.io/controller-runtime v0.10.2
1717
)
1818

19+
require (
20+
github.com/beorn7/perks v1.0.1 // indirect
21+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
22+
github.com/davecgh/go-spew v1.1.1 // indirect
23+
github.com/docker/cli v20.10.7+incompatible // indirect
24+
github.com/docker/distribution v2.7.1+incompatible // indirect
25+
github.com/docker/docker v20.10.7+incompatible // indirect
26+
github.com/docker/docker-credential-helpers v0.6.3 // indirect
27+
github.com/go-logr/logr v0.4.0 // indirect
28+
github.com/gogo/protobuf v1.3.2 // indirect
29+
github.com/golang/protobuf v1.5.2 // indirect
30+
github.com/google/go-cmp v0.5.6 // indirect
31+
github.com/google/gofuzz v1.1.0 // indirect
32+
github.com/googleapis/gnostic v0.4.1 // indirect
33+
github.com/hashicorp/golang-lru v0.5.1 // indirect
34+
github.com/imdario/mergo v0.3.12 // indirect
35+
github.com/json-iterator/go v1.1.11 // indirect
36+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
37+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
38+
github.com/modern-go/reflect2 v1.0.1 // indirect
39+
github.com/opencontainers/go-digest v1.0.0 // indirect
40+
github.com/opencontainers/image-spec v1.0.1 // indirect
41+
github.com/pkg/errors v0.9.1 // indirect
42+
github.com/pmezard/go-difflib v1.0.0 // indirect
43+
github.com/prometheus/client_model v0.2.0 // indirect
44+
github.com/prometheus/common v0.26.0 // indirect
45+
github.com/prometheus/procfs v0.6.0 // indirect
46+
github.com/spf13/pflag v1.0.5 // indirect
47+
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
48+
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
49+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
50+
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 // indirect
51+
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
52+
golang.org/x/text v0.3.6 // indirect
53+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
54+
google.golang.org/appengine v1.6.7 // indirect
55+
google.golang.org/protobuf v1.26.0 // indirect
56+
gopkg.in/inf.v0 v0.9.1 // indirect
57+
gopkg.in/yaml.v2 v2.4.0 // indirect
58+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
59+
k8s.io/klog/v2 v2.8.0 // indirect
60+
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
61+
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
62+
sigs.k8s.io/yaml v1.2.0 // indirect
63+
)
64+
1965
replace (
2066
k8s.io/api => k8s.io/api v0.21.0
2167
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.0

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3k
138138
github.com/caddyserver/caddy v1.0.3/go.mod h1:G+ouvOY32gENkJC+jhgl62TyhvqEsFaDiZ4uw0RzP1E=
139139
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
140140
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
141-
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
142141
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
143142
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
144143
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)