From d4cc09ffe564dbd7513c977cd25b3d5e2db766a1 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Fri, 6 Jun 2025 11:15:40 +0200 Subject: [PATCH] feat: remove the usage of git submodules --- .github/workflows/ci.yaml | 17 ++++++++-- .github/workflows/publish.yaml | 39 ++++++++++++++-------- .github/workflows/release.yaml | 34 ++++++++++++++++--- .gitmodules | 3 -- Makefile | 8 ++--- hack/common | 1 - {hack => tools}/boilerplate.generatego.txt | 0 7 files changed, 70 insertions(+), 32 deletions(-) delete mode 100644 .gitmodules delete mode 160000 hack/common rename {hack => tools}/boilerplate.generatego.txt (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 89b8227..86a6cd9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,14 +17,19 @@ jobs: with: submodules: recursive + - name: Extract repository name + id: repo + run: | + echo "repo_name=$(basename "$GITHUB_REPOSITORY")" >> $GITHUB_ENV + - name: Generate Build Version - uses: hashicorp/actions-generate-metadata@main + uses: hashicorp/actions-generate-metadata@f6f1ca9cededa05d841a58d171064faf3de8ec74 #main id: execute with: repositoryOwner: ${{ github.repository_owner }} repository: ${{ github.repository }} version: cat VERSION - product: gateway-extension + product: ${{ env.repo_name }} metadataFileName: ${{ github.workspace }}/build_version.json - name: Print Build Version @@ -36,10 +41,16 @@ jobs: with: go-version-file: go.mod + - name: Checkout build (taskfiles) repo + run: | + git clone https://github.com/openkcm/build.git ./hack/common + - name: Install Task - uses: arduino/setup-task@v2 + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 #v2.0.0 with: version: 3.x + env: + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} - name: task validate run: task validate --verbose diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0ca1ca8..ca901d6 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -35,10 +35,35 @@ jobs: fetch-depth: 0 submodules: recursive + - name: Extract repository name + id: repo + run: | + echo "repo_name=$(basename "$GITHUB_REPOSITORY")" >> $GITHUB_ENV + + - name: Generate Build Version + uses: hashicorp/actions-generate-metadata@f6f1ca9cededa05d841a58d171064faf3de8ec74 #main + id: execute + with: + repositoryOwner: ${{ github.repository_owner }} + repository: ${{ github.repository }} + version: cat VERSION + product: ${{ env.repo_name }} + metadataFileName: ${{ github.workspace }}/build_version.json + + - name: Print Build Version + shell: bash + run: cat ${{ github.workspace }}/build_version.json + + - name: Checkout build (taskfiles) repo + run: | + git clone https://github.com/openkcm/build.git ./hack/common + - name: Install Task uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 #v2.0.0 with: version: 3.x + env: + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} - name: Read and validate VERSION id: version @@ -84,20 +109,6 @@ jobs: with: go-version-file: go.mod - - name: Generate Build Version - uses: hashicorp/actions-generate-metadata@f6f1ca9cededa05d841a58d171064faf3de8ec74 #main - id: execute - with: - repositoryOwner: ${{ github.repository_owner }} - repository: ${{ github.repository }} - version: cat VERSION - product: gateway-extension - metadataFileName: ${{ github.workspace }}/build_version.json - - - name: Print Build Version - shell: bash - run: cat ${{ github.workspace }}/build_version.json - - name: Build and Push Images run: | task build:img:all --verbose diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 784dbc4..77a24ec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,10 +32,35 @@ jobs: fetch-depth: 0 submodules: recursive + - name: Extract repository name + id: repo + run: | + echo "repo_name=$(basename "$GITHUB_REPOSITORY")" >> $GITHUB_ENV + + - name: Generate Build Version + uses: hashicorp/actions-generate-metadata@f6f1ca9cededa05d841a58d171064faf3de8ec74 #main + id: execute + with: + repositoryOwner: ${{ github.repository_owner }} + repository: ${{ github.repository }} + version: cat VERSION + product: ${{ env.repo_name }} + metadataFileName: ${{ github.workspace }}/build_version.json + + - name: Print Build Version + shell: bash + run: cat ${{ github.workspace }}/build_version.json + + - name: Checkout build (taskfiles) repo + run: | + git clone https://github.com/openkcm/build.git ./hack/common + - name: Install Task uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 #v2.0.0 with: version: 3.x + env: + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} - name: Read and validate VERSION id: version @@ -151,7 +176,7 @@ jobs: - name: Generate SBOM if: ${{ env.SKIP != 'true' }} run: | - task cyclonedxgomod:mod-application --verbose + task cyclonedxgomod:app --verbose - name: Create GitHub release if: ${{ env.SKIP != 'true' }} @@ -160,7 +185,7 @@ jobs: tag_name: ${{ env.version }} name: Release ${{ env.version }} body: ${{steps.github_release.outputs.changelog}} - files: "sbom.json" + files: "*sbom.json" draft: true prerelease: false env: @@ -169,9 +194,8 @@ jobs: - name: Clean up SBOM files if: ${{ env.SKIP != 'true' }} run: | - echo "Removing the following SBOM files:" - rm -f sbom.json - rm -rf bin/ + rm -f *sbom.json + rm -rf hack - name: Create pr for next version if: ${{ env.SKIP != 'true' }} diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index db82630..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "hack/common"] - path = hack/common - url = https://github.com/openkcm/build.git diff --git a/Makefile b/Makefile index bdad08e..77a711a 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,7 @@ NAME := gateway-extension IMGTAG ?= latest IMG ?= localhost/$(NAME):${IMGTAG} -hacks.dir = hack - -$(tools.bindir)/%: $(tools.srcdir)/%/pin.go $(tools.srcdir)/%/go.mod - cd $(