From 6d53eed3ce745152d7df55b659902207296fcc6d Mon Sep 17 00:00:00 2001 From: Thibaut Rousseau Date: Fri, 15 Mar 2024 15:09:26 +0100 Subject: [PATCH] prepare migration to smocker-dev org disable sonar temporarily update docker login vars --- .github/workflows/main.yml | 15 ++++++++------- .gitignore | 1 - Dockerfile | 7 ++++--- Makefile | 5 ++--- README.md | 14 +++++++------- client/components/App.tsx | 2 +- go.mod | 2 +- main.go | 4 ++-- server/admin_server.go | 6 +++--- server/handlers/admin.go | 4 ++-- server/handlers/mocks.go | 6 +++--- server/middlewares.go | 4 ++-- server/mock_server.go | 6 +++--- server/services/graphs.go | 2 +- server/services/mocks.go | 2 +- server/services/persistence.go | 2 +- server/templates/go_template.go | 2 +- server/templates/interface.go | 2 +- server/templates/lua.go | 2 +- sonar-project.properties | 2 +- 20 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e28402c..a050bc2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,13 +2,13 @@ name: CI on: push: branches: - - master + - main tags: - '*.*.*' # semver, will override latest - '*-preview' # preview, won't override latest pull_request: branches: - - master + - main workflow_dispatch: # Allow manual trigger jobs: @@ -118,11 +118,13 @@ jobs: - name: Docker login uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GH_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: @@ -132,8 +134,7 @@ jobs: run: make VERSION=${{ steps.extract_ref.outputs.GIT_REF }} deploy-docker - name: Deploy on GitHub releases - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: build/smocker.tar.gz - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.GH_TOKEN }} diff --git a/.gitignore b/.gitignore index 5bf8af4..fe121a1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ node_modules/ sessions/ smocker smocker.test -vendor/ yarn-error.log diff --git a/Dockerfile b/Dockerfile index 1fafbb5..38ee85e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM golang:1.18-alpine AS build-backend +ARG GO_VERSION=1.22 +FROM golang:${GO_VERSION}-alpine AS build-backend RUN apk add --no-cache make ARG VERSION=snapshot ARG COMMIT -WORKDIR /go/src/github.com/Thiht/smocker +WORKDIR /go/src/smocker COPY go.mod go.sum ./ RUN go mod download COPY Makefile main.go ./ @@ -13,5 +14,5 @@ FROM alpine WORKDIR /opt EXPOSE 8080 8081 COPY build/client client/ -COPY --from=build-backend /go/src/github.com/Thiht/smocker/build/* /opt/ +COPY --from=build-backend /go/src/smocker/build/* /opt/ CMD ["/opt/smocker"] diff --git a/Makefile b/Makefile index c82d4c4..3b2a60a 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,7 @@ ifeq ($(RELEASE), 1) endif GO_LDFLAGS:=-ldflags="$(GO_LDFLAGS)" -DOCKER_ACCOUNT?=thiht -DOCKER_IMAGE=$(DOCKER_ACCOUNT)/$(APPNAME) +DOCKER_IMAGE=ghcr.io/smocker-dev/smocker # See: https://docs.docker.com/engine/reference/commandline/tag/#extended-description # A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. @@ -63,7 +62,7 @@ start: $(REFLEX) .PHONY: build build: - go build $(GO_LDFLAGS) -o ./build/$(APPNAME) + go build -trimpath $(GO_LDFLAGS) -o ./build/$(APPNAME) .PHONY: lint lint: $(GOLANGCILINT) diff --git a/README.md b/README.md index 092ce27..6c627c0 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ Smocker -[![CI](https://github.com/Thiht/smocker/actions/workflows/main.yml/badge.svg)](https://github.com/Thiht/smocker/actions/workflows/main.yml) -[![Docker Repository](https://img.shields.io/badge/docker-thiht%2Fsmocker-blue?logo=docker)](https://hub.docker.com/r/thiht/smocker) -[![Github Release](https://img.shields.io/github/v/release/Thiht/smocker.svg?logo=github)](https://github.com/Thiht/smocker/releases/latest) -[![Go Report Card](https://goreportcard.com/badge/github.com/Thiht/smocker)](https://goreportcard.com/report/github.com/Thiht/smocker) -[![License](https://img.shields.io/github/license/Thiht/smocker?logo=open-source-initiative)](https://github.com/Thiht/smocker/blob/master/LICENSE) +[![CI](https://github.com/smocker-dev/smocker/actions/workflows/main.yml/badge.svg)](https://github.com/smocker-dev/smocker/actions/workflows/main.yml) + +[![Github Release](https://img.shields.io/github/v/release/smocker-dev/smocker.svg?logo=github)](https://github.com/smocker-dev/smocker/releases/latest) +[![Go Report Card](https://goreportcard.com/badge/github.com/smocker-dev/smocker)](https://goreportcard.com/report/github.com/smocker-dev/smocker) +[![License](https://img.shields.io/github/license/smocker-dev/smocker?logo=open-source-initiative)](https://github.com/smocker-dev/smocker/blob/main/LICENSE) **Smocker** (server mock) is a simple and efficient HTTP mock server. @@ -40,7 +40,7 @@ docker run -d \ -p 8080:8080 \ -p 8081:8081 \ --name smocker \ - thiht/smocker + ghcr.io/smocker-dev/smocker ``` ### Manual Deployment @@ -48,7 +48,7 @@ docker run -d \ ```sh # This will be the deployment folder for the Smocker instance mkdir -p /opt/smocker && cd /opt/smocker -wget -P /tmp https://github.com/Thiht/smocker/releases/latest/download/smocker.tar.gz +wget -P /tmp https://github.com/smocker-dev/smocker/releases/latest/download/smocker.tar.gz tar xf /tmp/smocker.tar.gz nohup ./smocker -mock-server-listen-port=8080 -config-listen-port=8081 & ``` diff --git a/client/components/App.tsx b/client/components/App.tsx index e937ac9..359abba 100644 --- a/client/components/App.tsx +++ b/client/components/App.tsx @@ -47,7 +47,7 @@ const App = () => ( Smocker version {window.version} – MIT Licensed