Compare commits
2 Commits
86cd5f2472
...
943ba1e819
Author | SHA1 | Date | |
---|---|---|---|
943ba1e819
|
|||
e708807feb
|
72
.gitlab-ci.yml
Normal file
72
.gitlab-ci.yml
Normal 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
|
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
@@ -28,21 +29,30 @@ func cleanBadDomains(domains []string) []string {
|
|||||||
// remove duplicates
|
// remove duplicates
|
||||||
domains = removeDuplicateStr(domains)
|
domains = removeDuplicateStr(domains)
|
||||||
|
|
||||||
|
fmt.Printf("Processing: \n")
|
||||||
|
|
||||||
for _, domain := range domains {
|
for _, domain := range domains {
|
||||||
// removing trailing dots
|
// removing trailing dots
|
||||||
domain = regexp.MustCompile(`\.$`).ReplaceAllString(domain, "")
|
domain = regexp.MustCompile(`\.$`).ReplaceAllString(domain, "")
|
||||||
|
|
||||||
// skip domains that are too long
|
// skip domains that are too long
|
||||||
if len([]rune(domain)) > 230 {
|
if len([]rune(domain)) > 230 {
|
||||||
|
fmt.Printf("-")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip domains that are allowed
|
// skip domains that are allowed
|
||||||
|
var skip bool
|
||||||
for _, allowRegex := range cfg.ConfigFile.AllowLists {
|
for _, allowRegex := range cfg.ConfigFile.AllowLists {
|
||||||
if regexp.MustCompile(allowRegex).MatchString(domain) {
|
if regexp.MustCompile(allowRegex).MatchString(domain) {
|
||||||
|
skip = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if skip {
|
||||||
|
fmt.Printf(".")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// add domain
|
// add domain
|
||||||
cleanDomains = append(cleanDomains, domain)
|
cleanDomains = append(cleanDomains, domain)
|
||||||
|
Reference in New Issue
Block a user