From 6057cc4631ed3c0b0bbb3b21fddcd7fd75aa10c9 Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Sat, 21 Sep 2024 18:52:43 +0000 Subject: [PATCH 1/5] fix: Add static binaries to release Signed-off-by: Arjun Raja Yogidas --- .github/workflows/release-automation.yaml | 19 ++++++++++--------- Makefile | 11 +++++++++-- scripts/create-releases.sh | 11 ++++++++++- scripts/verify-release-artifacts.sh | 2 +- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-automation.yaml b/.github/workflows/release-automation.yaml index fcb0a269..0d0df221 100644 --- a/.github/workflows/release-automation.yaml +++ b/.github/workflows/release-automation.yaml @@ -32,10 +32,6 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-tags: true - - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ${{ env.GO_VERSION }} - cache: false - name: 'Echo RELEASE_TAG ENV' run: echo ${{ env.RELEASE_TAG }} - name: Setup variables and release directories @@ -43,22 +39,27 @@ jobs: export release_tag=${{ env.RELEASE_TAG }} export release_version=${release_tag/v/} # Remove v from tag name echo "DYNAMIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64.tar.gz" >> $GITHUB_ENV + echo "STATIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64-static.tar.gz" >> $GITHUB_ENV mkdir release - name: Install Go licenses run: go install github.com/google/go-licenses@latest - name: Create Third Party Licences File run: make licenses + - name: setup static dependecies + run: sudo apt-get install glibc-static libstdc++-static - name: Create release binaries run: make RELEASE_TAG=${{ env.RELEASE_TAG }} release - name: Verify Release version run: | - mkdir output - tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output - BINARY_VERSION=$(./output/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') + mkdir -p output/static output/dynamic + tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output/dynamic + tar -xzf release/${{ env.STATIC_BINARY_NAME }} -C ./output/static + DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') + STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') export release_tag=${{ env.RELEASE_TAG }} export release_version=${release_tag/v/} - if ["$BINARY_VERSION" != "$release_version"]; then + if ["$STATIC_BINARY_VERSION" != "$release_version"] || ["$DYNAMIC_BINARY_VERSION" != "$release_version"]; then echo "Version mismatch" exit 1 fi @@ -95,6 +96,6 @@ jobs: tag_name: ${{ needs.generate-artifacts.outputs.release_tag }} prerelease: false generate_release_notes: false - files: | + files: |- ${{ needs.generate-artifacts.outputs.dynamic_binary_name }} ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum diff --git a/Makefile b/Makefile index 409abff1..3f3cd6f1 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,15 @@ build: $(eval PACKAGE := github.com/runfinch/finch-daemon) $(eval VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.modified' --always --tags)) $(eval GITCOMMIT := $(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)) +ifneq ($(STATIC),) + $(eval GO_BUILDTAGS := osusergo netgo) + $(eval LDFLAGS := "-X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT) -extldflags '-static'") + @echo "Building Static Binary" +else + @echo "Building Dynamic Binary" $(eval LDFLAGS := "-X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT)") - GOOS=linux go build -ldflags $(LDFLAGS) -v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon +endif + GOOS=linux go build $(if $(GO_BUILDTAGS), -tags "$(GO_BUILDTAGS)") -ldflags $(LDFLAGS) $(if $(STATIC), ) -v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon .PHONY: linux linux: @@ -105,4 +112,4 @@ run-e2e-tests: linux .PHONY: release release: linux @echo "$@" - @$(FINCH_DAEMON_PROJECT_ROOT)/scripts/create-releases.sh $(RELEASE_TAG) + @$(FINCH_DAEMON_PROJECT_ROOT)/scripts/create-releases.sh $(RELEASE_TAG) \ No newline at end of file diff --git a/scripts/create-releases.sh b/scripts/create-releases.sh index d5d1bf9f..fb07e1a7 100755 --- a/scripts/create-releases.sh +++ b/scripts/create-releases.sh @@ -54,6 +54,7 @@ fi release_version=${1/v/} # Remove v from tag name dynamic_binary_name=finch-daemon-${release_version}-linux-${ARCH}.tar.gz +static_binary_name=finch-daemon-${release_version}-linux-${ARCH}-static.tar.gz make build cp "$LICENSE_FILE" "${OUT_DIR}" @@ -62,6 +63,14 @@ tar -czvf "$RELEASE_DIR"/"$dynamic_binary_name" -- * popd rm -rf "{$OUT_DIR:?}"/* +STATIC=1 make build +cp "$LICENSE_FILE" "${OUT_DIR}" +pushd "$OUT_DIR" +tar -czvf "$RELEASE_DIR"/"$static_binary_name" -- * +popd +rm -rf "{$OUT_DIR:?}"/* + pushd "$RELEASE_DIR" sha256sum "$dynamic_binary_name" > "$RELEASE_DIR"/"$dynamic_binary_name".sha256sum -popd +sha256sum "$static_binary_name" > "$RELEASE_DIR"/"$static_binary_name".sha256sum +popd \ No newline at end of file diff --git a/scripts/verify-release-artifacts.sh b/scripts/verify-release-artifacts.sh index f194e4d4..d90a9d35 100755 --- a/scripts/verify-release-artifacts.sh +++ b/scripts/verify-release-artifacts.sh @@ -44,7 +44,7 @@ release_tag=$1 release_version=${release_tag/v/} pushd "$release_dir" || exit 1 -tarballs=("finch-daemon-${release_version}-linux-${arch}.tar.gz") +tarballs=("finch-daemon-${release_version}-linux-${arch}.tar.gz" "finch-daemon-${release_version}-linux-${arch}-static.tar.gz") expected_contents=("finch-daemon" "THIRD_PARTY_LICENSES") release_is_valid=true From 2dbdf02dd2396af2a3f801c27c9995d719c8532f Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Sat, 21 Sep 2024 19:11:51 +0000 Subject: [PATCH 2/5] fix: Add static binaries to release 2 Signed-off-by: Arjun Raja Yogidas --- .github/workflows/release-automation.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release-automation.yaml b/.github/workflows/release-automation.yaml index 0d0df221..6ebc4ef2 100644 --- a/.github/workflows/release-automation.yaml +++ b/.github/workflows/release-automation.yaml @@ -32,6 +32,10 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-tags: true + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version: ${{ env.GO_VERSION }} + cache: false - name: 'Echo RELEASE_TAG ENV' run: echo ${{ env.RELEASE_TAG }} - name: Setup variables and release directories From f626f3f45b5eca973c1277fb62f54a61cceb97df Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:17:42 +0000 Subject: [PATCH 3/5] chore(main): release 0.9.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6db3039d..f77e0848 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.0" + ".": "0.9.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 907f68dc..a317fd34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,37 @@ # Changelog +## [0.9.1](https://github.com/coderbirju/finch-daemon/compare/v0.9.0...v0.9.1) (2024-09-21) + + +### Build System or External Dependencies + +* **deps:** bump github.com/containerd/go-cni from 1.1.9 to 1.1.10 ([#53](https://github.com/coderbirju/finch-daemon/issues/53)) ([31583b0](https://github.com/coderbirju/finch-daemon/commit/31583b0bd25dfdcf5c53ae78882b9df3ac36cc11)) +* **deps:** bump github.com/onsi/ginkgo/v2 from 2.17.1 to 2.20.2 ([#19](https://github.com/coderbirju/finch-daemon/issues/19)) ([e282c25](https://github.com/coderbirju/finch-daemon/commit/e282c253bfdd2bad7e97866e75598291892fb7fa)) +* **deps:** bump github.com/onsi/gomega from 1.32.0 to 1.34.2 ([#18](https://github.com/coderbirju/finch-daemon/issues/18)) ([ea72df3](https://github.com/coderbirju/finch-daemon/commit/ea72df3f479e10ef0de0357a31a1686d626f5041)) +* **deps:** bump github.com/spf13/cobra from 1.8.0 to 1.8.1 ([#49](https://github.com/coderbirju/finch-daemon/issues/49)) ([3eff666](https://github.com/coderbirju/finch-daemon/commit/3eff666f81e4ea655b9d70e5fa7e8043283ec959)) +* **deps:** bump github.com/vishvananda/netlink from 1.2.1-beta.2 to 1.3.0 ([#50](https://github.com/coderbirju/finch-daemon/issues/50)) ([e3cffc7](https://github.com/coderbirju/finch-daemon/commit/e3cffc77ac28451c15d5c6a04ab63fd89c34fe4b)) + + +### Features + +* add container create options ([#27](https://github.com/coderbirju/finch-daemon/issues/27)) ([504dcaf](https://github.com/coderbirju/finch-daemon/commit/504dcaf9eff1316c9dd40db82a4ecce9b3e1796d)) +* allow custom socket path ([#7](https://github.com/coderbirju/finch-daemon/issues/7)) ([4c17545](https://github.com/coderbirju/finch-daemon/commit/4c1754576d5beb3bd6b12e36893a588b2bb95825)) +* implement container restart API ([#23](https://github.com/coderbirju/finch-daemon/issues/23)) ([5d9b1e0](https://github.com/coderbirju/finch-daemon/commit/5d9b1e0f4e1565fd374b0f0941f373a094dc749c)) +* Port 'implement container restart API' patch ([5d9b1e0](https://github.com/coderbirju/finch-daemon/commit/5d9b1e0f4e1565fd374b0f0941f373a094dc749c)) + + +### Bug Fixes + +* Add static binaries to release ([6057cc4](https://github.com/coderbirju/finch-daemon/commit/6057cc4631ed3c0b0bbb3b21fddcd7fd75aa10c9)) +* Add static binaries to release 2 ([2dbdf02](https://github.com/coderbirju/finch-daemon/commit/2dbdf02dd2396af2a3f801c27c9995d719c8532f)) +* doc nits and parameter casing ([#57](https://github.com/coderbirju/finch-daemon/issues/57)) ([e22c156](https://github.com/coderbirju/finch-daemon/commit/e22c156cc8bcb97f25c6f41a14e833203e8798ce)) +* filter unsupported enable_icc option ([#36](https://github.com/coderbirju/finch-daemon/issues/36)) ([6c5e72d](https://github.com/coderbirju/finch-daemon/commit/6c5e72d4e8c9f6a5be12bf38078798423d11064f)) +* image load should close stream after copy ([#34](https://github.com/coderbirju/finch-daemon/issues/34)) ([5ee657b](https://github.com/coderbirju/finch-daemon/commit/5ee657b17de96c1d2302e9ee7490ccfdc64cd907)) +* README changes re: systemd setup ([#59](https://github.com/coderbirju/finch-daemon/issues/59)) ([2096ded](https://github.com/coderbirju/finch-daemon/commit/2096ded2283a8582186be01eeee42a8c0ab6161d)) +* Set release version to 0.9.0 ([#56](https://github.com/coderbirju/finch-daemon/issues/56)) ([024768a](https://github.com/coderbirju/finch-daemon/commit/024768a6937ab2917870f9a3348dc0be114d3523)) +* truncate image id on publish tag event ([#35](https://github.com/coderbirju/finch-daemon/issues/35)) ([6aa5b7c](https://github.com/coderbirju/finch-daemon/commit/6aa5b7ce76979682ad1cf2b49ac0237a74cac809)) + ## 0.9.0 Finch-Daemon Init This is the first release of the Finch Daemon. -The Finch Daemon project is an open source container runtime engine that enables users to integrate software that uses Docker's RESTful APIs as a programmatic dependency. \ No newline at end of file +The Finch Daemon project is an open source container runtime engine that enables users to integrate software that uses Docker's RESTful APIs as a programmatic dependency. From 8a7ab5e96379f6511725879c580b1912f79fe8b6 Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Tue, 24 Sep 2024 21:40:39 +0000 Subject: [PATCH 4/5] fix: add some data to the scripts Signed-off-by: Arjun Raja Yogidas --- .github/workflows/release-automation.yaml | 10 ++++++++-- setup-test-env.sh | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-automation.yaml b/.github/workflows/release-automation.yaml index 6ebc4ef2..2049072e 100644 --- a/.github/workflows/release-automation.yaml +++ b/.github/workflows/release-automation.yaml @@ -50,8 +50,14 @@ jobs: run: go install github.com/google/go-licenses@latest - name: Create Third Party Licences File run: make licenses - - name: setup static dependecies - run: sudo apt-get install glibc-static libstdc++-static + - name: Install Dependencies for e2e Testing + run: ./setup-test-env.sh + # - name: setup static dependecies + # run: | + # sudo apt-get update + # sudo apt-get install glibc-static libstdc++-static + # sudo apt install libstdc++-12-dev + # sudo apt-get install libc6-dev - name: Create release binaries run: make RELEASE_TAG=${{ env.RELEASE_TAG }} release - name: Verify Release version diff --git a/setup-test-env.sh b/setup-test-env.sh index 6b8387fc..2285a10d 100755 --- a/setup-test-env.sh +++ b/setup-test-env.sh @@ -6,7 +6,7 @@ NERDCTL_VERSION=1.7.6 BUILDKIT_VERSION=0.15.2 CNI_VERSION=1.5.1 -apt update && apt install -y make gcc linux-libc-dev libseccomp-dev pkg-config git +apt update && apt install -y make gcc linux-libc-dev libseccomp-dev pkg-config git libc6-compat zlib-dev # Download and install containerd curl -sSL --output /tmp/containerd.tgz https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-${TARGETARCH:-amd64}.tar.gz From 10de90d280fb80631cfb713f04f586c818a2c0cf Mon Sep 17 00:00:00 2001 From: Arjun Raja Yogidas Date: Tue, 24 Sep 2024 21:51:16 +0000 Subject: [PATCH 5/5] feat: add some data to the scripts 2 Signed-off-by: Arjun Raja Yogidas --- .github/workflows/testing-release.yaml | 123 +++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/workflows/testing-release.yaml diff --git a/.github/workflows/testing-release.yaml b/.github/workflows/testing-release.yaml new file mode 100644 index 00000000..96b4e08a --- /dev/null +++ b/.github/workflows/testing-release.yaml @@ -0,0 +1,123 @@ +name: Release Finch Daemon +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + branches: + - main + paths-ignore: + - '**.md' + workflow_dispatch: + workflow_call: +env: + GO_VERSION: '1.22.7' +permissions: + contents: write + deployments: write +jobs: + get-latest-tag: + name: Get the latest release tag + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.latest-tag.outputs.tag }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-depth: 0 + - name: 'Get the latest tag' + id: latest-tag + uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0 + generate-artifacts: + needs: get-latest-tag + runs-on: ubuntu-20.04 + env: + # Set during setup. + RELEASE_TAG: ${{ needs.get-latest-tag.outputs.tag }} + DYNAMIC_BINARY_NAME: '' + STATIC_BINARY_NAME: '' + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-tags: true + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version: ${{ env.GO_VERSION }} + cache: false + - name: 'Echo RELEASE_TAG ENV' + run: echo ${{ env.RELEASE_TAG }} + - name: Setup variables and release directories + run: | + export release_tag=${{ env.RELEASE_TAG }} + export release_version=${release_tag/v/} # Remove v from tag name + echo "DYNAMIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64.tar.gz" >> $GITHUB_ENV + echo "STATIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64-static.tar.gz" >> $GITHUB_ENV + + mkdir release + - name: Install Go licenses + run: go install github.com/google/go-licenses@latest + - name: Create Third Party Licences File + run: make licenses + - name: Install Dependencies for e2e Testing + run: ./setup-test-env.sh + - name: setup static dependecies + run: | + sudo apt-get update + sudo apt-get install libc6-dev -f + - name: Create release binaries + run: make RELEASE_TAG=${{ env.RELEASE_TAG }} release + - name: Verify Release version + run: | + mkdir -p output/static output/dynamic + tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output/dynamic + tar -xzf release/${{ env.STATIC_BINARY_NAME }} -C ./output/static + ./output/dynamic/finch-daemon --version + ./output/static/finch-daemon --version + DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') + STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+') + export release_tag=${{ env.RELEASE_TAG }} + export release_version=${release_tag/v/} + echo $DYNAMIC_BINARY_VERSION + echo $STATIC_BINARY_VERSION + if ["$STATIC_BINARY_VERSION" != "$release_version"] || ["$DYNAMIC_BINARY_VERSION" != "$release_version"]; then + echo "Version mismatch" + exit 1 + fi + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: artifacts + path: release/ + if-no-files-found: error + outputs: + release_tag: ${{ env.RELEASE_TAG }} + dynamic_binary_name: ${{ env.DYNAMIC_BINARY_NAME }} + static_binary_name: ${{ env.STATIC_BINARY_NAME }} + validate-artifacts: + needs: generate-artifacts + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: artifacts + path: release/ + - run: bash scripts/verify-release-artifacts.sh ${{ needs.generate-artifacts.outputs.release_tag }} +# create-release: +# needs: [generate-artifacts, validate-artifacts] +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/download-artifact@v4 +# with: +# name: artifacts +# - uses: softprops/action-gh-release@v2 +# with: +# tag_name: ${{ needs.generate-artifacts.outputs.release_tag }} +# prerelease: false +# generate_release_notes: false +# files: |- +# ${{ needs.generate-artifacts.outputs.dynamic_binary_name }} +# ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum