From b34da59efcec3c5075816a8b3462302e77d12521 Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (MacBook-Pro-de-Mathieu-1.home)" Date: Wed, 22 Dec 2021 10:46:39 +0100 Subject: [PATCH 1/6] fix: no more hardcoded version in code --- plik/client.go | 2 +- server/common/version.go | 9 --------- server/common/version_test.go | 8 +------- server/gen_build_info.sh | 2 +- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/plik/client.go b/plik/client.go index 67fabe08..50d3836a 100644 --- a/plik/client.go +++ b/plik/client.go @@ -34,7 +34,7 @@ func NewClient(url string) (c *Client) { // Default values for X-ClientApp and X-ClientVersion HTTP Headers c.ClientName = "plik_client" - c.ClientVersion = runtime.GOOS + "-" + runtime.GOARCH + "-" + common.GetVersion() + c.ClientVersion = runtime.GOOS + "-" + runtime.GOARCH + "-" + common.GetBuildInfo().Version // Create a new default HTTP client. Override it if may you have more specific requirements transport := &http.Transport{ diff --git a/server/common/version.go b/server/common/version.go index be94ed75..787ab394 100644 --- a/server/common/version.go +++ b/server/common/version.go @@ -10,13 +10,6 @@ import ( "github.com/jinzhu/copier" ) -const version = "1.3.2" - -// GetVersion return the current package version -func GetVersion() string { - return version -} - // This variable content is meant to be passed the output of the gen_build_info.sh script at compile time using -ldflags var buildInfoString string @@ -36,8 +29,6 @@ func init() { panic(fmt.Errorf("Unable to parse build info json string : %s", err)) } } - - buildInfo.Version = GetVersion() } // BuildInfo export build related variables diff --git a/server/common/version_test.go b/server/common/version_test.go index f20f827c..7c699ef3 100644 --- a/server/common/version_test.go +++ b/server/common/version_test.go @@ -32,12 +32,6 @@ func TestValidateVersionRegex(t *testing.T) { validateVersion(t, "1.1-rc1", false) } -func TestGetVersion(t *testing.T) { - version := GetVersion() - require.NotZero(t, version, "missing version") - validateVersion(t, version, true) -} - func TestGetBuildInfo(t *testing.T) { buildInfo := GetBuildInfo() require.NotNil(t, buildInfo, "missing build info") @@ -56,5 +50,5 @@ func TestGetBuildInfoStringSanitize(t *testing.T) { buildInfo := GetBuildInfo() buildInfo.Sanitize() v := buildInfo.String() - require.Equal(t, fmt.Sprintf("v%s", GetVersion()), v, "invalid build string") + require.Equal(t, fmt.Sprintf("v%s", buildInfo.Version), v, "invalid build string") } diff --git a/server/gen_build_info.sh b/server/gen_build_info.sh index 3db41edf..d242a627 100755 --- a/server/gen_build_info.sh +++ b/server/gen_build_info.sh @@ -11,7 +11,7 @@ if [[ ! -f "$FILE" ]]; then exit 1 fi -version=${VERSION:-$(cat "$FILE" | sed -n 's/^const version = "\(.*\)"/\1/p')} +version=${VERSION:-$(git describe --tags --abbrev=0)} if [[ -z "$version" ]]; then echo "version not found" exit 1 From 82217a6226930798f1f7a3c041df084f3f57a4b1 Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (MacBook-Pro-de-Mathieu-1.home)" Date: Wed, 22 Dec 2021 10:58:14 +0100 Subject: [PATCH 2/6] fix: bad lint --- server/handlers/create_upload_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/handlers/create_upload_test.go b/server/handlers/create_upload_test.go index 6ebb3446..a6e0a08e 100644 --- a/server/handlers/create_upload_test.go +++ b/server/handlers/create_upload_test.go @@ -210,7 +210,7 @@ func TestCreateInvalidRequestBody(t *testing.T) { type NeverEndingReader struct{} func (r *NeverEndingReader) Read(p []byte) (n int, err error) { - for i, _ := range p { + for i := range p { p[i] = byte('x') } return len(p), nil From 8e3c2e602dee37bc8a3e23999b960c76d107aaac Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (MacBook-Pro-de-Mathieu-1.home)" Date: Wed, 22 Dec 2021 11:06:13 +0100 Subject: [PATCH 3/6] feat: use fmt with simplify arg --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3bb374c7..e2eaa70a 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ lint: # Run fmt ### fmt: - @goimports -w -l -local "github.com/root-gg/plik" $(shell find . -type f -name '*.go' -not -path "./vendor/*") + @gofmt -w -s $(shell find . -type f -name '*.go' -not -path "./vendor/*" ) ### # Run tests From 547af8c97c43c8140703ce3a23dea4a9f67118fa Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (MacBook-Pro-de-Mathieu-1.home)" Date: Wed, 22 Dec 2021 11:12:22 +0100 Subject: [PATCH 4/6] fix: init version with default value --- server/common/version.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/common/version.go b/server/common/version.go index 787ab394..11cd52fb 100644 --- a/server/common/version.go +++ b/server/common/version.go @@ -16,7 +16,9 @@ var buildInfoString string var buildInfo *BuildInfo func init() { - buildInfo = &BuildInfo{} + buildInfo = &BuildInfo{ + Version: "0.0.0", + } if buildInfoString != "" { jsonString, err := base64.StdEncoding.DecodeString(buildInfoString) From 047a0fd14144b9674e6bb26f4ed11673785cbc4a Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (MacBook-Pro-de-Mathieu-1.home)" Date: Wed, 22 Dec 2021 11:42:21 +0100 Subject: [PATCH 5/6] fix: fetch tags when releasing/testing on github actions --- .github/workflows/release.yaml | 4 ++++ .github/workflows/tests.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 081e159a..1a6e4fa4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,6 +11,10 @@ jobs: steps: - name: Check out code into the Go module directory uses: actions/checkout@v2 + + - name: Fetch tags + run: | + git fetch --prune --unshallow --tags - name: Login to Docker Hub uses: docker/login-action@v1 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 786b6289..cb81271a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -10,6 +10,10 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 + - name: Fetch tags + run: | + git fetch --prune --unshallow --tags + - name: Run linter run: make lint From 7c5e962cbf9825dbd51ce23948c2b94efe71effb Mon Sep 17 00:00:00 2001 From: "Mathieu Bodjikian (MacBook-Pro-de-Mathieu-1.home)" Date: Wed, 22 Dec 2021 11:50:58 +0100 Subject: [PATCH 6/6] bump version to 1.3.3, and add changelog --- README.md | 8 ++++---- changelog/1.3.3 | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 changelog/1.3.3 diff --git a/README.md b/README.md index 758f6af2..cf4ec0fe 100644 --- a/README.md +++ b/README.md @@ -30,16 +30,16 @@ Plik is a scalable & friendly temporary file upload system (Wetransfer like) in - [Filelink for Plik](https://gitlab.com/joendres/filelink-plik) : Thunderbird Addon to upload attachments to Plik ### Version -1.3.2 +1.3.3 ### Installation ##### From release To run plik, it's very simple : ```sh -$ wget https://github.com/root-gg/plik/releases/download/1.3.2/plik-1.3.2-linux-amd64.tar.gz -$ tar xzvf plik-1.3.2-linux-64bits.tar.gz -$ cd plik-1.3.2/server +$ wget https://github.com/root-gg/plik/releases/download/1.3.2/plik-1.3.3-linux-amd64.tar.gz +$ tar xzvf plik-1.3.3-linux-64bits.tar.gz +$ cd plik-1.3.3/server $ ./plikd ``` Et voilĂ  ! You now have a fully functional instance of Plik running on http://127.0.0.1:8080. diff --git a/changelog/1.3.3 b/changelog/1.3.3 new file mode 100644 index 00000000..ae43a271 --- /dev/null +++ b/changelog/1.3.3 @@ -0,0 +1,23 @@ +Plik 1.3.3 + +Hi, today we're releasing Plik 1.3.3 ! + +Here is the changelog : + +New + - New metadata backend : MySQL / MariaDB \o/ + - Update gorm and go-sqlite3 libraries + - Provide a usage example for docker-compose + +Fixed + - Improve clean and logging + - Swift|S3 data backend: DO not fail when removing missing file + - Simplify GCS backend + - Properly remove uploading files + - Fix transaction issue in DeleteUser + - Fix export of soft deleted uploads / Add import --ignore-error parameter + - Properly close metadata backend during tests + + +Faithfully, +The plik team \ No newline at end of file