Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add workq redis implemention #196

Merged
merged 18 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ deploy/
docs/
e2e/
scripts/
bin/
assets/
7 changes: 4 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ jobs:
IP=`hostname -I | awk '{print $1}'`
echo '{"insecure-registries" : ["'$IP':3000"]}' | sudo tee /etc/docker/daemon.json
sudo service docker restart
echo $DOCKER_HOST

make docker-build-dev
make docker-build
- name: Run sigma
run: |
docker run --name sigma -d -p 3000:3000 sigma:latest
docker run --name sigma -v /var/run/docker.sock:/var/run/docker.sock -d -p 3000:3000 sigma:latest
sleep 5
docker logs sigma
- name: Test push and e2e with k6
run: |
./e2e/push.sh
curl https://github.com/grafana/k6/releases/download/v0.45.0/k6-v0.45.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
curl https://github.com/grafana/k6/releases/download/v0.46.0/k6-v0.46.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
./k6 run e2e/sc.js
8 changes: 5 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
node: ["18"]
steps:
- name: Checkout branch
Expand All @@ -38,10 +38,12 @@ jobs:
cd web
yarn install --frozen-lockfile
yarn build
cd ..
make build
- name: Setup golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.2
version: v1.54.2
args: --deadline=10m --verbose
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
Expand All @@ -51,5 +53,5 @@ jobs:
- name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: ./build/local.Dockerfile
dockerfile: ./build/Dockerfile.local
ignore: DL3018,DL3003
4 changes: 2 additions & 2 deletions .github/workflows/local-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
node: ["18"]
steps:
- name: Checkout branch
Expand All @@ -39,4 +39,4 @@ jobs:
yarn install --frozen-lockfile
yarn build
cd ..
make build-release
make build
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
node: ["18"]
services:
mysql:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
node: ["18"]
services:
mysql:
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
node: ["18"]
services:
mysql:
Expand Down
36 changes: 17 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,22 @@ GOFLAGS = -ldflags '-s -w $(GOLDFLAGS)'

.PHONY: all test build vendor

all: build
all: build build-builder

all-linux: build-linux build-builder-linux

## Build:
build: ## Build sigma and put the output binary in ./bin
@$(GOCMD) mod download
@CGO_ENABLED=1 GO111MODULE=on $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME) -v .
@GO111MODULE=on $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME) -v .

## Build:
build-builder: ## Build sigma-builder and put the output binary in ./bin
@$(GOCMD) mod download
@CGO_ENABLED=0 GO111MODULE=on $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME)-builder -v ./cmd/builder

build-release: ## Build sigma for release and put the output binary in ./bin
@$(GOCMD) mod download
@CGO_ENABLED=1 GO111MODULE=on $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME) -v .
@GO111MODULE=on $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME)-builder -v ./cmd/builder

build-builder-release: ## Build sigma-builder for release and put the output binary in ./bin
@$(GOCMD) mod download
@CGO_ENABLED=0 GO111MODULE=on $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME)-builder -v ./cmd/builder
build-linux: ## Build sigma for linux and put the output binary in ./bin
@GO111MODULE=on GOOS=linux $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME) -v .

build-linux: ## Build your project for linux and put the output binary in ./bin
@CGO_ENABLED=1 GO111MODULE=on GOOS=linux $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME) -v .
build-builder-linux: ## Build sigma-builder for release and put the output binary in ./bin
@GO111MODULE=on GOOS=linux $(GOCMD) build $(GOFLAGS) -tags timetzdata -o bin/$(BINARY_NAME)-builder -v ./cmd/builder

clean: ## Remove build related file
rm -fr ./bin
Expand Down Expand Up @@ -100,13 +94,16 @@ endif

## Docker:
docker-build: ## Use the dockerfile to build the container
docker buildx build --platform=linux/amd64,linux/arm64 -f build/Dockerfile --rm --tag $(BINARY_NAME) .
docker build -f build/Dockerfile --rm --tag $(BINARY_NAME) .

docker-build-local: build-linux ## Build the container with the local binary
docker build -f build/local.Dockerfile --rm --tag $(BINARY_NAME) .
docker build -f build/Dockerfile.local --rm --tag $(BINARY_NAME) .

docker-build-dev: ## Build the dev container
docker build -f build/Dockerfile --rm --tag $(BINARY_NAME) .
docker-build-builder: ## Build the dev container
docker build -f build/Dockerfile.builder --rm --tag $(BINARY_NAME)-builder .

docker-build-builder-local: build-builder-linux # Build sigma builder image
docker build -f build/Dockerfile.builder.local --rm --tag $(BINARY_NAME)-builder .

docker-release: ## Release the container with tag latest and version
docker tag $(BINARY_NAME) $(DOCKER_REGISTRY)$(BINARY_NAME):latest
Expand All @@ -129,6 +126,7 @@ gormgen: ## Generate gorm model from database
@$(GOCMD) run ./pkg/dal/cmd/gen.go

swagen: ## Generate swagger from code comments
@swag fmt
@swag init --output pkg/handlers/apidocs

addlicense: ## Add license to all go files
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/go-sigma/sigma/test.yml?style=for-the-badge) ![Codecov](https://img.shields.io/codecov/c/github/go-sigma/sigma?style=for-the-badge) ![GitHub repo size](https://img.shields.io/github/repo-size/go-sigma/sigma?style=for-the-badge)

Yet another harbor OCI artifact manager. Harbor is a great product, but it's not easy to use, it is so complex. So I want to make a simple artifact manager and well tested. And it never depends on [distribution](https://github.com/distribution/distribution) like harbor.
Yet another OCI artifact manager. [Harbor](https://goharbor.io/) is a great product, but it's not easy to use, it is so complex. So I want to make a simple artifact manager, it never depends on [distribution](https://github.com/distribution/distribution) like [harbor](https://goharbor.io/), no [distribution](https://github.com/distribution/distribution).

## Introduction

Expand Down
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_VERSION=1.20.7-alpine3.18
ARG GOLANG_VERSION=1.21.2-alpine3.18
ARG NODE_VERSION=18-alpine3.18
ARG ALPINE_VERSION=3.18

Expand Down Expand Up @@ -61,7 +61,7 @@ COPY --from=web-builder /web/dist /go/src/github.com/go-sigma/sigma/web/dist

WORKDIR /go/src/github.com/go-sigma/sigma

RUN make build-release
RUN make build

FROM alpine:${ALPINE_VERSION}

Expand Down
10 changes: 5 additions & 5 deletions build/Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_VERSION=1.20.6-alpine3.18
ARG GOLANG_VERSION=1.21.2-alpine3.18

FROM golang:${GOLANG_VERSION} as builder

Expand All @@ -7,16 +7,16 @@ COPY . /go/src/github.com/go-sigma/sigma
WORKDIR /go/src/github.com/go-sigma/sigma

RUN set -eux && \
# sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \
sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \
apk add --no-cache make bash ncurses build-base git git-lfs

RUN make build-builder-release
RUN make build-builder

FROM moby/buildkit:v0.12.1-rootless
FROM moby/buildkit:v0.12.2-rootless

USER root
RUN set -eux && \
# sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \
sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \
apk add --no-cache git-lfs && \
mkdir -p /code/ && \
chown -R 1000:1000 /opt/ && \
Expand Down
15 changes: 15 additions & 0 deletions build/Dockerfile.builder.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM moby/buildkit:v0.12.2-rootless

USER root
RUN set -eux && \
sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && \
apk add --no-cache git-lfs && \
mkdir -p /code/ && \
chown -R 1000:1000 /opt/ && \
chown -R 1000:1000 /code/

COPY ./bin/sigma-builder /usr/local/bin/sigma-builder

WORKDIR /code

USER 1000:1000
4 changes: 2 additions & 2 deletions build/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_VERSION=1.20.7
ARG GOLANG_VERSION=1.21.2
ARG NODE_VERSION=18-alpine3.18
ARG ALPINE_VERSION=3.18
ARG DEBIAN_VERSION=bullseye-slim
Expand Down Expand Up @@ -67,7 +67,7 @@ COPY --from=web-builder /web/dist /go/src/github.com/go-sigma/sigma/web/dist

WORKDIR /go/src/github.com/go-sigma/sigma

RUN make build-release
RUN make build

FROM debian:${DEBIAN_VERSION}

Expand Down
File renamed without changes.
Loading
Loading