diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..2d465a6 --- /dev/null +++ b/.gitlab-ci.yml @@ -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