Skip to content

Commit

Permalink
Merge branch 'master' into gandi_v5-auth-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Jan 5, 2024
2 parents b3dde44 + 393efcf commit 8cb583c
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 247 deletions.
30 changes: 12 additions & 18 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: "PR: Run all tests"
on:
# git push origin master:tlim_testpr --force
# will trigger a full PR test on the master branch:
# https://github.com/StackExchange/dnscontrol/actions/workflows/pr_test.yml?query=branch%3Atlim_testpr
push:
branches:
- 'tlim_testpr'
pull_request:
workflow_dispatch:

Expand All @@ -11,12 +17,16 @@ env:
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.21
env:
TEST_RESULTS: "/tmp/test-results"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: restore_cache
uses: actions/cache@v3.3.2
with:
Expand All @@ -39,16 +49,6 @@ jobs:
run: |
go install golang.org/x/tools/cmd/stringer@latest
# For some reason goreleaser isn't correctly setting the version
# string used by "dnscontrol version". Therefore, we're forcing the
# string using the GORELEASER_CURRENT_TAG feature.
# TODO(tlim): Use the native gorelease version mechanism.
- name: Retrieve version
id: version
run: |
echo "TAG_NAME=$(git config --global --add safe.directory /__w/dnscontrol/dnscontrol ; git describe)" >> $GITHUB_OUTPUT
- name: Reveal version
run: echo ${{ steps.version.outputs.TAG_NAME }}
-
id: build_binaries_tagged
name: Build binaries (if tagged)
Expand All @@ -58,19 +58,13 @@ jobs:
distribution: goreleaser
version: latest
args: build
env:
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
-
id: build_binaries_not_tagged
name: Build binaries (not tagged)
if: github.ref_type != 'tag'
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: build --snapshot
env:
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
integration-test-providers:
needs: build
runs-on: ubuntu-latest
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ jobs:
run: |
go install golang.org/x/tools/cmd/stringer@latest
# For some reason goreleaser isn't correctly setting the version
# string used by "dnscontrol version". Therefore, we're forcing the
# string using the GORELEASER_CURRENT_TAG feature.
# TODO(tlim): Use the native gorelease version mechanism.

- name: Retrieve version
id: version
run: |
echo "TAG_NAME=$(git config --global --add safe.directory /__w/dnscontrol/dnscontrol ; git describe --tags)" >> $GITHUB_OUTPUT
- name: Reveal version
run: echo ${{ steps.version.outputs.TAG_NAME }}
-
id: release
name: Goreleaser release
Expand All @@ -71,4 +59,3 @@ jobs:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ builds:
- goos: freebsd
goarch: "386"
ldflags:
- -linkmode=internal -s -w -X main.Version="{{ .Version }}" -X main.SHA="{{ .FullCommit }}" -X main.BuildTime={{ .Timestamp }}
- -linkmode=internal -s -w
- -X main.version={{ .Version }}
before:
hooks:
- go fmt ./...
Expand Down
3 changes: 1 addition & 2 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"os/exec"
"strings"
"time"
)

var sha = flag.String("sha", "", "SHA of current commit")
Expand All @@ -16,7 +15,7 @@ var goos = flag.String("os", "", "OS to build (linux, windows, or darwin) Defaul

func main() {
flag.Parse()
flags := fmt.Sprintf(`-s -w -X "main.SHA=%s" -X main.BuildTime=%d`, getVersion(), time.Now().Unix())
flags := fmt.Sprintf(`-s -w -X "main.version=%s"`, getVersion())
pkg := "github.com/StackExchange/dnscontrol/v4"

build := func(out, goos string) {
Expand Down
7 changes: 1 addition & 6 deletions commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ const (

var commands = []*cli.Command{}

// These are set by/for goreleaser
var (
version = "dev"
)

func cmd(cat string, c *cli.Command) bool {
c.Category = cat
commands = append(commands, c)
Expand All @@ -52,7 +47,7 @@ func Run(v string) int {
app.Version = version
app.Name = "dnscontrol"
app.HideVersion = true
app.Usage = "dnscontrol is a compiler and DSL for managing dns zones"
app.Usage = "DNSControl is a compiler and DSL for managing dns zones"
app.Flags = []cli.Flag{
&cli.BoolFlag{
Name: "v",
Expand Down
8 changes: 6 additions & 2 deletions commands/writeTypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import (
_ "embed" // Required by go:embed
"os"

versionInfo "github.com/StackExchange/dnscontrol/v4/pkg/version"
"github.com/urfave/cli/v2"
)

// GoReleaser: version
var (
version = "dev"
)

var _ = cmd(catUtils, func() *cli.Command {
var args TypesArgs
return &cli.Command{
Expand Down Expand Up @@ -50,7 +54,7 @@ func WriteTypes(args TypesArgs) error {

file.WriteString("// This file was automatically generated by DNSControl. Do not edit it directly.\n")
file.WriteString("// To update it, run `dnscontrol write-types`.\n\n")
file.WriteString("// DNSControl version: " + versionInfo.Banner() + "\n")
file.WriteString("// " + version + "\n")
file.WriteString(dtsContent)
if err != nil {
return err
Expand Down
17 changes: 17 additions & 0 deletions integrationTest/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,23 @@ func makeTests(t *testing.T) []*TestGroup {
tc("Update 1200 records", manyA("rec%04d", "1.2.3.5", 1200)...),
),

// Test the boundaries of Google' batch system.
// 1200 is used because it is larger than batchMax.
// https://github.com/StackExchange/dnscontrol/pull/2762#issuecomment-1877825559
testgroup("batchRecordswithOthers",
only(
"GCLOUD",
),
tc("1200 records",
manyA("rec%04d", "1.2.3.4", 1200)...),
tc("Update 1200 records and Create others", append(
manyA("arec%04d", "1.2.3.4", 1200),
manyA("rec%04d", "1.2.3.5", 1200)...)...),
tc("Update 1200 records and Create and Delete others", append(
manyA("rec%04d", "1.2.3.4", 1200),
manyA("zrec%04d", "1.2.3.4", 1200)...)...),
),

//// CanUse* types:

// Narrative: Many DNS record types are optional. If the provider
Expand Down
13 changes: 3 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package main

import (
"fmt"
"log"
"os"
"runtime/debug"

"github.com/StackExchange/dnscontrol/v4/commands"
"github.com/StackExchange/dnscontrol/v4/pkg/version"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all"
"github.com/fatih/color"
)
Expand All @@ -17,22 +15,17 @@ import (
// Version management. Goals:
// 1. Someone who just does "go get" has at least some information.
// 2. If built with build/build.go, more specific build information gets put in.
// GoReleaser: version
var (
SHA = ""
Version = ""
BuildTime = ""
version = "dev"
)

func main() {
version.SHA = SHA
version.Semver = Version
version.BuildTime = BuildTime
if os.Getenv("CI") == "true" {
color.NoColor = false
}
log.SetFlags(log.LstdFlags | log.Lshortfile)
if info, ok := debug.ReadBuildInfo(); !ok && info == nil {
fmt.Fprint(os.Stderr, "Warning: dnscontrol was built without Go modules. See https://docs.dnscontrol.org/getting-started/getting-started#source for more information on how to build dnscontrol correctly.\n\n")
}
os.Exit(commands.Run("dnscontrol " + version.Banner()))
os.Exit(commands.Run("DNSControl " + version))
}
44 changes: 0 additions & 44 deletions pkg/version/version.go

This file was deleted.

0 comments on commit 8cb583c

Please sign in to comment.