refactor(ci): simplify vault dependency handling in build workflow
Some checks failed
Build and Release / Create Release (push) Has been skipped
Build and Release / Unit Tests (push) Failing after 17s
Build and Release / Lint (push) Failing after 45s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been cancelled
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled
Build and Release / Integration Tests (PostgreSQL) (push) Has been cancelled
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been cancelled
Some checks failed
Build and Release / Create Release (push) Has been skipped
Build and Release / Unit Tests (push) Failing after 17s
Build and Release / Lint (push) Failing after 45s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been cancelled
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled
Build and Release / Integration Tests (PostgreSQL) (push) Has been cancelled
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been cancelled
Replace complex vault version fetching and go.mod rewriting with direct git clone of vault dependency. This simplifies the build process by using the local replace directive in go.mod instead of dynamically updating to a specific version. Remove API calls to fetch latest vault version and eliminate go.mod manipulation steps. The vault repository is now cloned once at the start of each job.
This commit is contained in:
@@ -25,22 +25,14 @@ jobs:
|
||||
name: Lint
|
||||
runs-on: linux-latest
|
||||
steps:
|
||||
- name: Get latest vault version
|
||||
id: vault
|
||||
run: |
|
||||
VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4)
|
||||
echo "version=$VERSION"
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure private repo access
|
||||
- name: Clone vault dependency
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
VAULT_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
git config --global url."https://token:${RELEASE_TOKEN}@git.marketally.com/".insteadOf "https://git.marketally.com/"
|
||||
git config --global url."https://token:${RELEASE_TOKEN}@direct.git.marketally.com/".insteadOf "https://direct.git.marketally.com/"
|
||||
git clone --depth 1 "https://token:${VAULT_TOKEN}@git.marketally.com/gitcaddy/gitcaddy-vault.git" ../gitcaddy-vault
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
@@ -48,16 +40,8 @@ jobs:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: false
|
||||
|
||||
- name: Update vault dependency
|
||||
env:
|
||||
GOPRIVATE: ""
|
||||
run: |
|
||||
set -x
|
||||
VAULT_VERSION="${{ steps.vault.outputs.version }}"
|
||||
echo "Building with vault $VAULT_VERSION"
|
||||
sed -i "s|replace git.marketally.com/gitcaddy/gitcaddy-vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/gitcaddy-vault => git.marketally.com/gitcaddy/gitcaddy-vault $VAULT_VERSION|" go.mod
|
||||
cat go.mod | grep -A2 "gitcaddy-vault" || true
|
||||
go mod tidy -v 2>&1
|
||||
- name: Tidy modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
@@ -82,21 +66,14 @@ jobs:
|
||||
name: Unit Tests
|
||||
runs-on: linux-latest
|
||||
steps:
|
||||
- name: Get latest vault version
|
||||
id: vault
|
||||
run: |
|
||||
VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4)
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure private repo access
|
||||
- name: Clone vault dependency
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
VAULT_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
git config --global url."https://token:${RELEASE_TOKEN}@git.marketally.com/".insteadOf "https://git.marketally.com/"
|
||||
git config --global url."https://token:${RELEASE_TOKEN}@direct.git.marketally.com/".insteadOf "https://direct.git.marketally.com/"
|
||||
git clone --depth 1 "https://token:${VAULT_TOKEN}@git.marketally.com/gitcaddy/gitcaddy-vault.git" ../gitcaddy-vault
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
@@ -104,16 +81,6 @@ jobs:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: false
|
||||
|
||||
- name: Update vault dependency
|
||||
env:
|
||||
GOPRIVATE: ""
|
||||
run: |
|
||||
set -x
|
||||
VAULT_VERSION="${{ steps.vault.outputs.version }}"
|
||||
sed -i "s|replace git.marketally.com/gitcaddy/gitcaddy-vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/gitcaddy-vault => git.marketally.com/gitcaddy/gitcaddy-vault $VAULT_VERSION|" go.mod
|
||||
cat go.mod | grep -A2 "gitcaddy-vault" || true
|
||||
go mod tidy -v 2>&1
|
||||
|
||||
- name: Install dependencies
|
||||
run: go mod download
|
||||
|
||||
@@ -146,21 +113,14 @@ jobs:
|
||||
ports:
|
||||
- 5432:5432
|
||||
steps:
|
||||
- name: Get latest vault version
|
||||
id: vault
|
||||
run: |
|
||||
VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4)
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure private repo access
|
||||
- name: Clone vault dependency
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
VAULT_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
git config --global url."https://token:${RELEASE_TOKEN}@git.marketally.com/".insteadOf "https://git.marketally.com/"
|
||||
git config --global url."https://token:${RELEASE_TOKEN}@direct.git.marketally.com/".insteadOf "https://direct.git.marketally.com/"
|
||||
git clone --depth 1 "https://token:${VAULT_TOKEN}@git.marketally.com/gitcaddy/gitcaddy-vault.git" ../gitcaddy-vault
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
@@ -168,15 +128,8 @@ jobs:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: false
|
||||
|
||||
- name: Update vault dependency
|
||||
env:
|
||||
GOPRIVATE: ""
|
||||
run: |
|
||||
set -x
|
||||
VAULT_VERSION="${{ steps.vault.outputs.version }}"
|
||||
sed -i "s|replace git.marketally.com/gitcaddy/gitcaddy-vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/gitcaddy-vault => git.marketally.com/gitcaddy/gitcaddy-vault $VAULT_VERSION|" go.mod
|
||||
cat go.mod | grep -A2 "gitcaddy-vault" || true
|
||||
go mod tidy -v 2>&1
|
||||
- name: Tidy modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
|
||||
Reference in New Issue
Block a user