Skip to content

Commit b52a503

Browse files
authored
Merge pull request #2 from openinfradev/initial_import
feature. initial import
2 parents 0d96fc6 + 1a86370 commit b52a503

19 files changed

+3389
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Create and publish a package
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- release**
7+
jobs:
8+
build-and-push-image:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
password: ${{ secrets.DOCKERHUB_TOKEN }}
22+
23+
- name: Build and push
24+
id: docker_build
25+
uses: docker/build-push-action@v2
26+
with:
27+
push: true
28+
tags: |
29+
sktcloud/tks-cluster-lcm:${{ github.head_ref }}-${{ github.sha }}
30+
sktcloud/tks-cluster-lcm:latest
31+
build-args: |
32+
PRV_GITHUB_TOKEN=${{ secrets.PRV_GITHUB_TOKEN }}

.github/workflows/deploy-image.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Create and publish a package
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release**
7+
jobs:
8+
build-and-push-image:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
password: ${{ secrets.DOCKERHUB_TOKEN }}
22+
23+
- name: Build and push
24+
id: docker_build
25+
uses: docker/build-push-action@v2
26+
with:
27+
push: true
28+
tags: sktcloud/tks-cluster-lcm:latest
29+
build-args: |
30+
PRV_GITHUB_TOKEN=${{ secrets.PRV_GITHUB_TOKEN }}

.github/workflows/golangcic-lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- main
8+
- release**
9+
pull_request:
10+
jobs:
11+
golangci:
12+
name: lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Configure git for private modules
17+
run: git config --global url."https://x-access-token:${{ secrets.PRV_GITHUB_TOKEN }}@github.com/openinfradev".insteadOf "https://github.com/openinfradev"
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v2
20+
with:
21+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
22+
version: latest
23+
args: --timeout=5m
24+
25+
# Optional: working directory, useful for monorepos
26+
# working-directory: somedir
27+
28+
# Optional: golangci-lint command line arguments.
29+
# args: --issues-exit-code=0
30+
31+
# Optional: show only new issues if it's a pull request. The default value is `false`.
32+
# only-new-issues: true
33+
34+
# Optional: if set to true then the action will use pre-installed Go.
35+
# skip-go-installation: true
36+
37+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
38+
# skip-pkg-cache: true
39+
40+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
41+
# skip-build-cache: true

.github/workflows/stale.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Close stale issues and PRs'
2+
on:
3+
schedule:
4+
- cron: '30 1,13 * * *'
5+
6+
jobs:
7+
stale:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/stale@v3
11+
with:
12+
repo-token: ${{ secrets.GITHUB_TOKEN }}
13+
stale-issue-message: 'This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 3 days.'
14+
stale-pr-message: 'This PR is stale because it has been open 3 days with no activity. Remove stale label or comment or this will be closed in 3 days.'
15+
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
16+
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
17+
days-before-issue-stale: 7
18+
days-before-pr-stale: 3
19+
days-before-issue-close: 3
20+
days-before-pr-close: 3

.github/workflows/unittest.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- release**
6+
pull_request:
7+
branches:
8+
- main
9+
- release**
10+
jobs:
11+
unittest:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out repository code
15+
uses: actions/checkout@v2
16+
17+
- name: Configure git for private modules
18+
run: git config --global url."https://x-access-token:${{ secrets.PRV_GITHUB_TOKEN }}@github.com/openinfradev".insteadOf "https://github.com/openinfradev"
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.17
24+
25+
- name: Build
26+
run: go build -v ./...
27+
28+
- name: Test
29+
run: go test -v -cover ./...

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM golang:1.16.3-stretch AS builder
2+
3+
ARG PRV_GITHUB_TOKEN
4+
RUN go env -w GOPRIVATE=github.com/openinfradev/tks-batch
5+
RUN git config --global url."https://x-access-token:${PRV_GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
6+
7+
RUN mkdir -p /build
8+
WORKDIR /build
9+
10+
COPY . .
11+
RUN go mod tidy && go mod vendor
12+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/server ./cmd/server
13+
14+
RUN mkdir -p /dist
15+
WORKDIR /dist
16+
RUN cp /build/bin/server ./server
17+
18+
19+
20+
FROM golang:alpine3.13
21+
22+
RUN mkdir -p /app
23+
WORKDIR /app
24+
25+
COPY --chown=0:0 --from=builder /dist /app/
26+
EXPOSE 9110
27+
28+
ENTRYPOINT ["/app/server"]
29+
CMD ["-port", "9110"]

0 commit comments

Comments
 (0)