This commit is contained in:
+8
-25
@@ -1,11 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
|
|
||||||
# Inputs expected from the workflow:
|
|
||||||
# GITHUB_REPOSITORY - owner/repo of the current action repo (provided by Actions)
|
|
||||||
# GITHUB_SHA - commit to clone/check out (provided by Actions, optional)
|
|
||||||
# GO_VERSION - optional, e.g. "1.23.3"; if unset, script will query latest.
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# 1. Create temp directory
|
# 1. Create temp directory
|
||||||
TMPDIR="$(mktemp -d)"
|
TMPDIR="$(mktemp -d)"
|
||||||
@@ -55,36 +50,24 @@ main() {
|
|||||||
mv plugin.cfg.new plugin.cfg
|
mv plugin.cfg.new plugin.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 6. Regenerate plugin source files
|
# 6. go mod replace plugin path to the cloned action repo
|
||||||
|
# This assumes the plugin lives at github.com/doubleu-labs/coredns-netbox-plugin-dns in your repo. [web:16][web:23]
|
||||||
|
# Adjust relative path if your repo layout differs.
|
||||||
|
|
||||||
|
go mod edit -replace=github.com/doubleu-labs/coredns-netbox-plugin-dns="${ACTION_REPO_DIR}"
|
||||||
|
|
||||||
|
# 7. Regenerate plugin source files
|
||||||
# CoreDNS uses go generate (via Makefile) to rebuild plugin glue code. [web:20][web:26]
|
# CoreDNS uses go generate (via Makefile) to rebuild plugin glue code. [web:20][web:26]
|
||||||
|
|
||||||
make core/plugin/zplugin.go core/dnsserver/zdirectives.go
|
make core/plugin/zplugin.go core/dnsserver/zdirectives.go
|
||||||
|
|
||||||
# 7. go mod replace plugin path to the cloned action repo
|
|
||||||
# This assumes the plugin lives at github.com/doubleu-labs/coredns-netbox-plugin-dns in your repo. [web:16][web:23]
|
|
||||||
# Adjust relative path if your repo layout differs.
|
|
||||||
docker run --rm -it \
|
|
||||||
--user "$(id -u):$(id -g)" \
|
|
||||||
-v "$PWD":"/work" \
|
|
||||||
-w "/work" \
|
|
||||||
golang:latest go mod edit -replace=github.com/doubleu-labs/coredns-netbox-plugin-dns="${ACTION_REPO_DIR}"
|
|
||||||
|
|
||||||
# 8. Update Go version to the latest
|
# 8. Update Go version to the latest
|
||||||
# Install or pick latest Go and set GOTOOLCHAIN, or rely on pre-installed toolchain in the runner. [web:17]
|
# Install or pick latest Go and set GOTOOLCHAIN, or rely on pre-installed toolchain in the runner. [web:17]
|
||||||
# Here we query the latest stable from golang.org and export it for this build.
|
# Here we query the latest stable from golang.org and export it for this build.
|
||||||
if [ -z "${GO_VERSION:-}" ]; then
|
|
||||||
GO_VERSION="$(curl -s https://go.dev/VERSION?m=text | head -n1 | sed 's/^go//')" # e.g. "1.23.3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using Go version: ${GO_VERSION}"
|
echo "Using Go version: ${GO_VERSION}"
|
||||||
|
|
||||||
# If you use setup-go in the workflow, this is optional; otherwise install here.
|
export GOTOOLCHAIN="${GO_VERSION}"
|
||||||
# Example (Debian-based runner):
|
|
||||||
# sudo rm -rf /usr/local/go
|
|
||||||
# curl -sL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | sudo tar -C /usr/local -xz
|
|
||||||
# export PATH="/usr/local/go/bin:${PATH}"
|
|
||||||
|
|
||||||
export GOTOOLCHAIN="go${GO_VERSION}"
|
|
||||||
|
|
||||||
# 9. Compile CoreDNS
|
# 9. Compile CoreDNS
|
||||||
make coredns || make
|
make coredns || make
|
||||||
|
|||||||
Reference in New Issue
Block a user