From 431a744304063ffe78742b908e03b6c23723414b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 4 Nov 2021 23:04:18 -0400 Subject: [PATCH 1/7] feat: add code quality scanning --- .github/workflows/codeql-analysis.yml | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..0bb6d23 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '43 11 * * 2' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From 941f7eafaec4f5ff8e14cf4ad6c41dae02e0dfed Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 5 Nov 2021 01:09:10 -0400 Subject: [PATCH 2/7] feat: update the release name and body after creation --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c86f796..57fbe82 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,12 @@ bin/gh-release: tar xf bin/gh-release.tgz -C bin chmod +x bin/gh-release -release: build bin/gh-release +bin/gh-release-body: + mkdir -p bin + curl -o bin/gh-release-body "https://raw.githubusercontent.com/dokku/gh-release-body/master/gh-release-body" + chmod +x bin/gh-release-body + +release: build bin/gh-release bin/gh-release-body rm -rf release && mkdir release tar -zcf release/$(NAME)_$(VERSION)_linux_amd64.tgz -C build/linux $(NAME)-amd64 tar -zcf release/$(NAME)_$(VERSION)_linux_armhf.tgz -C build/linux $(NAME)-armhf @@ -166,6 +171,7 @@ release: build bin/gh-release cp build/deb/$(NAME)_$(VERSION)_armhf.deb release/$(NAME)_$(VERSION)_armhf.deb cp build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm release/$(NAME)-$(VERSION)-1.x86_64.rpm bin/gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) + bin/gh-release-body $(MAINTAINER)/$(REPOSITORY) v$(VERSION) release-packagecloud: @$(MAKE) release-packagecloud-deb From 1bd3e73a96e2e2ef12b5ff944a104e9b6bf79ae2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 5 Nov 2021 01:20:59 -0400 Subject: [PATCH 3/7] feat: upgrade ci builder to ubuntu 20.04 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf06d6b..85a10c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ on: jobs: build: name: build - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: fail-fast: true env: From 08dd5144a786f2b6c433816006a4a97f82baf2e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jan 2022 00:34:13 +0000 Subject: [PATCH 4/7] chore(deps): bump golang from 1.17.3-buster to 1.17.6-buster Bumps golang from 1.17.3-buster to 1.17.6-buster. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Dockerfile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.build b/Dockerfile.build index e371ace..eb228c3 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -1,4 +1,4 @@ -FROM golang:1.17.3-buster +FROM golang:1.17.6-buster RUN apt-get update \ && apt install apt-transport-https build-essential curl gnupg2 lintian rpm rsync rubygems-integration ruby-dev ruby -qy \ From c30dec224b540ffd7d8e463797c47130c01c27d7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 27 Jan 2022 22:55:28 -0500 Subject: [PATCH 5/7] feat: add support for arm64 Refs dokku/dokku#4974 --- Makefile | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 57fbe82..4f77ec8 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,12 @@ build/linux/$(NAME)-amd64: -ldflags "-s -w -X main.Version=$(VERSION)" \ -o build/linux/$(NAME)-amd64 +build/linux/$(NAME)-arm64: + mkdir -p build/linux + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -asmflags=-trimpath=/src -gcflags=-trimpath=/src \ + -ldflags "-s -w -X main.Version=$(VERSION)" \ + -o build/linux/$(NAME)-arm64 + build/linux/$(NAME)-armhf: mkdir -p build/linux CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -a -asmflags=-trimpath=/src -gcflags=-trimpath=/src \ @@ -100,6 +106,26 @@ build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME)-amd64 build/linux/$(NAME)-amd64=/usr/bin/$(NAME) \ LICENSE=/usr/share/doc/$(NAME)/copyright +build/deb/$(NAME)_$(VERSION)_arm64.deb: build/linux/$(NAME)-arm64 + export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \ + && mkdir -p build/deb \ + && fpm \ + --architecture arm64 \ + --category utils \ + --description "$$PACKAGE_DESCRIPTION" \ + --input-type dir \ + --license 'MIT License' \ + --maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \ + --name $(NAME) \ + --output-type deb \ + --package build/deb/$(NAME)_$(VERSION)_arm64.deb \ + --url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \ + --vendor "" \ + --version $(VERSION) \ + --verbose \ + build/linux/$(NAME)-arm64=/usr/bin/$(NAME) \ + LICENSE=/usr/share/doc/$(NAME)/copyright + build/deb/$(NAME)_$(VERSION)_armhf.deb: build/linux/$(NAME)-armhf export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \ && mkdir -p build/deb \ @@ -165,9 +191,11 @@ bin/gh-release-body: release: build bin/gh-release bin/gh-release-body rm -rf release && mkdir release tar -zcf release/$(NAME)_$(VERSION)_linux_amd64.tgz -C build/linux $(NAME)-amd64 + tar -zcf release/$(NAME)_$(VERSION)_linux_arm64.tgz -C build/linux $(NAME)-arm64 tar -zcf release/$(NAME)_$(VERSION)_linux_armhf.tgz -C build/linux $(NAME)-armhf tar -zcf release/$(NAME)_$(VERSION)_darwin_$(HARDWARE).tgz -C build/darwin $(NAME) cp build/deb/$(NAME)_$(VERSION)_amd64.deb release/$(NAME)_$(VERSION)_amd64.deb + cp build/deb/$(NAME)_$(VERSION)_arm64.deb release/$(NAME)_$(VERSION)_arm64.deb cp build/deb/$(NAME)_$(VERSION)_armhf.deb release/$(NAME)_$(VERSION)_armhf.deb cp build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm release/$(NAME)-$(VERSION)-1.x86_64.rpm bin/gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) @@ -177,12 +205,13 @@ release-packagecloud: @$(MAKE) release-packagecloud-deb @$(MAKE) release-packagecloud-rpm -release-packagecloud-deb: build/deb/$(NAME)_$(VERSION)_amd64.deb build/deb/$(NAME)_$(VERSION)_armhf.deb +release-packagecloud-deb: build/deb/$(NAME)_$(VERSION)_amd64.deb build/deb/$(NAME)_$(VERSION)_arm64.deb build/deb/$(NAME)_$(VERSION)_armhf.deb package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/bionic build/deb/$(NAME)_$(VERSION)_amd64.deb package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_amd64.deb package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/stretch build/deb/$(NAME)_$(VERSION)_amd64.deb package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/buster build/deb/$(NAME)_$(VERSION)_amd64.deb package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bullseye build/deb/$(NAME)_$(VERSION)_amd64.deb + package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_arm64.deb package_cloud push $(PACKAGECLOUD_REPOSITORY)/raspbian/buster build/deb/$(NAME)_$(VERSION)_armhf.deb release-packagecloud-rpm: build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm @@ -191,16 +220,21 @@ release-packagecloud-rpm: build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm validate: mkdir -p validation lintian build/deb/$(NAME)_$(VERSION)_amd64.deb || true + lintian build/deb/$(NAME)_$(VERSION)_arm64.deb || true lintian build/deb/$(NAME)_$(VERSION)_armhf.deb || true dpkg-deb --info build/deb/$(NAME)_$(VERSION)_amd64.deb + dpkg-deb --info build/deb/$(NAME)_$(VERSION)_arm64.deb dpkg-deb --info build/deb/$(NAME)_$(VERSION)_armhf.deb dpkg -c build/deb/$(NAME)_$(VERSION)_amd64.deb + dpkg -c build/deb/$(NAME)_$(VERSION)_arm64.deb dpkg -c build/deb/$(NAME)_$(VERSION)_armhf.deb cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_amd64.deb + cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_arm64.deb cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_armhf.deb cd validation && rpm2cpio ../build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm > $(NAME)-$(VERSION)-1.x86_64.cpio ls -lah build/deb build/rpm validation sha1sum build/deb/$(NAME)_$(VERSION)_amd64.deb + sha1sum build/deb/$(NAME)_$(VERSION)_arm64.deb sha1sum build/deb/$(NAME)_$(VERSION)_armhf.deb sha1sum build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm bats test.bats From 4f775369d93666a8948fd12052a20705f8ac1999 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 27 Jan 2022 22:59:34 -0500 Subject: [PATCH 6/7] fix: build the arm packages --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 4f77ec8..85f17e2 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,10 @@ targets = $(addsuffix -in-docker, $(LIST)) build: prebuild @$(MAKE) build/darwin/$(NAME) @$(MAKE) build/linux/$(NAME)-amd64 + @$(MAKE) build/linux/$(NAME)-arm64 @$(MAKE) build/linux/$(NAME)-armhf @$(MAKE) build/deb/$(NAME)_$(VERSION)_amd64.deb + @$(MAKE) build/deb/$(NAME)_$(VERSION)_arm64.deb @$(MAKE) build/deb/$(NAME)_$(VERSION)_armhf.deb @$(MAKE) build/rpm/$(NAME)-$(VERSION)-1.x86_64.rpm From 4465a8760490dccf9208fc1d97d92e301a15ffc5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 28 Jan 2022 15:21:52 -0500 Subject: [PATCH 7/7] Release 0.5.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 85f17e2..077fe8a 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ MAINTAINER_NAME = Jose Diaz-Gonzalez REPOSITORY = netrc HARDWARE = $(shell uname -m) SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]') -BASE_VERSION ?= 0.4.1 +BASE_VERSION ?= 0.5.0 IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY) PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish