Compare commits

..

2 Commits

Author SHA1 Message Date
943ba1e819 corrects incorrectly scoped continue 2025-06-27 17:35:27 -05:00
e708807feb autobuild 2025-06-27 17:34:58 -05:00
2 changed files with 82 additions and 0 deletions

72
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,72 @@
.rules-changes: &rules-changes
rules:
- changes:
- Jenkinsfile
- .gitlab-ci.yml
- README.md
- docs/*
when: never
- when: on_success
stages:
- build
"Build Release":
stage: build
<<: *rules-changes
image:
name: registry.c.test-chamber-13.lan/dockerhub/library/golang:alpine
allow_failure: false
variables:
GOPROXY: "https://nexus.c.test-chamber-13.lan/repository/go-proxy"
GOSUMDB: "sum.golang.org https://nexus.c.test-chamber-13.lan/repository/go-sumdb"
before_script:
- printf '%s\n' "${C_ROOT_CAS}" >> /etc/ssl/certs/ca-certificates.crt
script:
- GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -ldflags="-s -w" -o bind-response-policy-zone-creator-linux-arm ./cmd/bind
- GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bind-response-policy-zone-creator-linux-arm64 ./cmd/bind
- GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bind-response-policy-zone-creator-linux-amd64 ./cmd/bind
- GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bind-response-policy-zone-creator-windows-amd64.exe ./cmd/bind
- GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bind-response-policy-zone-creator-darwin-amd64 ./cmd/bind
- GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bind-response-policy-zone-creator-darwin-arm64 ./cmd/bind
- printf 'BUILD_JOB_ID=%s\n' "$CI_JOB_ID" >> build_environment_vars.env
artifacts:
paths:
- bind-response-policy-zone-creator-linux-arm
- bind-response-policy-zone-creator-linux-arm64
- bind-response-policy-zone-creator-linux-amd64
- bind-response-policy-zone-creator-windows-amd64.exe
- bind-response-policy-zone-creator-darwin-amd64
- bind-response-policy-zone-creator-darwin-arm64
reports:
dotenv: build_environment_vars.env
"Create Release":
stage: build
image:
name: registry.gitlab.com/gitlab-org/release-cli:latest
<<: *rules-changes
needs:
- job: "Build Release"
artifacts: true
script:
- printf '%s\n' "Creating Release"
release:
name: Version $CI_COMMIT_TAG
tag_name: $CI_COMMIT_TAG
description: Release created using the release-cli. Release $CI_COMMIT_TAG
assets:
links:
- name: bind-response-policy-zone-creator-linux-arm
url: $CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$BUILD_JOB_ID/artifacts/raw/bind-response-policy-zone-creator-linux-arm
- name: bind-response-policy-zone-creator-linux-arm64
url: $CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$BUILD_JOB_ID/artifacts/raw/bind-response-policy-zone-creator-linux-arm64
- name: bind-response-policy-zone-creator-linux-amd64
url: $CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$BUILD_JOB_ID/artifacts/raw/bind-response-policy-zone-creator-linux-amd64
- name: bind-response-policy-zone-creator-windows-amd64.exe
url: $CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$BUILD_JOB_ID/artifacts/raw/bind-response-policy-zone-creator-windows-amd64.exe
- name: bind-response-policy-zone-creator-darwin-amd64
url: $CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$BUILD_JOB_ID/artifacts/raw/bind-response-policy-zone-creator-darwin-amd64
- name: bind-response-policy-zone-creator-darwin-arm64
url: $CI_SERVER_URL/$CI_PROJECT_PATH/-/jobs/$BUILD_JOB_ID/artifacts/raw/bind-response-policy-zone-creator-darwin-arm64

View File

@@ -1,6 +1,7 @@
package main
import (
"fmt"
"regexp"
"sort"
@@ -28,21 +29,30 @@ func cleanBadDomains(domains []string) []string {
// remove duplicates
domains = removeDuplicateStr(domains)
fmt.Printf("Processing: \n")
for _, domain := range domains {
// removing trailing dots
domain = regexp.MustCompile(`\.$`).ReplaceAllString(domain, "")
// skip domains that are too long
if len([]rune(domain)) > 230 {
fmt.Printf("-")
continue
}
// skip domains that are allowed
var skip bool
for _, allowRegex := range cfg.ConfigFile.AllowLists {
if regexp.MustCompile(allowRegex).MatchString(domain) {
skip = true
continue
}
}
if skip {
fmt.Printf(".")
continue
}
// add domain
cleanDomains = append(cleanDomains, domain)