diff --git a/.github/workflows/pr_release_validation.yml b/.github/workflows/pr_release_validation.yml new file mode 100644 index 00000000..4f43ee45 --- /dev/null +++ b/.github/workflows/pr_release_validation.yml @@ -0,0 +1,69 @@ +name: PR Release Validation + +on: + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +jobs: + test-goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.24.1 + cache: true + + - name: Download Go dependencies + run: | + echo "Downloading Go modules..." + go mod download + echo "Go modules downloaded successfully" + + - name: Install osslsigncode + run: | + sudo apt-get update + sudo apt-get install -y osslsigncode + + - name: Generate self-signed test certificates + run: | + # Generate a private key + openssl genrsa -out test-key.pem 2048 + + # Generate a self-signed certificate + openssl req -new -x509 -key test-key.pem -out test-cert.pem -days 1 \ + -subj "/C=US/ST=Test/L=Test/O=SailPoint Test/CN=SailPoint CLI Test" + + # Export paths + echo "CERT_FILE=$(pwd)/test-cert.pem" >> $GITHUB_ENV + echo "KEY_FILE=$(pwd)/test-key.pem" >> $GITHUB_ENV + + - name: Set test version + run: echo "RELEASE_VERSION=0.0.0-test" >> $GITHUB_ENV + + - name: Run GoReleaser in Snapshot Mode + uses: goreleaser/goreleaser-action@v6 + with: + version: "2.8.2" + args: release --snapshot --clean --skip=publish --timeout 30m --config .goreleaser.test.yaml --parallelism 4 + env: + GORELEASER_CURRENT_TAG: "v0.0.0-test" + CERT_PASSWORD: "test" + + - name: Upload artifacts for inspection + uses: actions/upload-artifact@v4 + with: + name: test-release-artifacts + path: dist/ + retention-days: 7 + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d59074d..ebf5e53e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ env: jobs: goreleaser: - runs-on: macOS-15 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -32,6 +32,13 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.24.1 + cache: true + + - name: Download Go dependencies + run: | + echo "Downloading Go modules..." + go mod download + echo "Go modules downloaded successfully" - name: Set Tag Name id: tagName @@ -39,7 +46,9 @@ jobs: echo "tag-name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - name: Install osslsigncode - run: brew install osslsigncode + run: | + sudo apt-get update + sudo apt-get install -y osslsigncode - name: Obtain signing cert run: | @@ -64,7 +73,7 @@ jobs: uses: goreleaser/goreleaser-action@v6 with: version: "2.8.2" - args: release --clean --verbose --timeout 60m + args: release --clean --verbose --timeout 60m --parallelism 4 env: GITHUB_TOKEN: ${{secrets.PUBLISHER_TOKEN}} GORELEASER_CURRENT_TAG: ${{steps.tagName.outputs.tag-name}} diff --git a/.goreleaser.test.yaml b/.goreleaser.test.yaml new file mode 100644 index 00000000..502c49ea --- /dev/null +++ b/.goreleaser.test.yaml @@ -0,0 +1,84 @@ +project_name: sail + +version: 2 + +release: + prerelease: auto + draft: true + name_template: "SailPoint CLI {{.Version}}" + +before: + hooks: + - go mod tidy + +builds: + - id: windows + goos: [windows] + goarch: ['386', amd64, arm64] # All Windows architectures + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X main.version={{ .Version }} + hooks: + post: + - cmd: ./assets/sign-windows-executable.sh '{{ .Path }}' + output: true + + - id: linux + goos: [linux] + goarch: ['386', arm, amd64, arm64] # All common Linux architectures + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X main.version={{ .Version }} + + - id: macos + binary: bin/sail + main: ./ + goos: [darwin] + goarch: [amd64, arm64] + ldflags: + - -s -w -X main.version={{ .Version }} + +archives: + - id: nix + ids: [macos, linux] + name_template: >- + {{- .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end -}} + wrap_in_directory: true + formats: tar.gz + files: + - LICENSE + + - id: windows + ids: [windows] + formats: zip + wrap_in_directory: false + files: + - LICENSE + +brews: + - name: sailpoint-cli + homepage: "https://github.com/sailpoint-oss/sailpoint-cli" + repository: + name: homebrew-tap + owner: sailpoint-oss + commit_author: + name: developer-relations-sp + email: devrel-service@sailpoint.com + +nfpms: + - license: MIT + maintainer: SailPoint + homepage: https://github.com/sailpoint-oss/sailpoint-cli + bindir: /usr + description: The SailPoint Command Line Interface. + formats: + - deb + - rpm + diff --git a/cmd/connector/conn_tag_update.go b/cmd/connector/conn_tag_update.go index 8e2b9ec3..95557e3c 100644 --- a/cmd/connector/conn_tag_update.go +++ b/cmd/connector/conn_tag_update.go @@ -27,12 +27,9 @@ func newConnTagUpdateCmd(client client.Client) *cobra.Command { tagName := cmd.Flags().Lookup("name").Value.String() versionStr := cmd.Flags().Lookup("version").Value.String() - version, err := strconv.Atoi(versionStr) + version, err := strconv.ParseUint(versionStr, 10, 32) if err != nil { - return err - } - if version < 0 || version > int(math.MaxUint32) { - return fmt.Errorf("active version must be between 0 and %d", math.MaxUint32) + return fmt.Errorf("active version must be a valid number between 0 and %d", uint32(math.MaxUint32)) } raw, err := json.Marshal(TagUpdate{ActiveVersion: uint32(version)}) if err != nil {