Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
y0rune committed Dec 10, 2022
0 parents commit 94fdb5e
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Source from https://github.com/krisnova/go-nova/blob/main/Makefile

all: compile

version ?= @(git describe --tags --abbrev=0)
org ?= y0rune
target ?= fortios-release
authorname ?= Marcin Woźniak
authoremail ?= [email protected]
license ?= MIT
year ?= 2022
copyright ?= Copyright (c) $(year)
gofile ?= main.go

compile:
@echo "Compiling..."
go build -ldflags "\
-X 'github.com/$(org)/$(target).Version=$(version)' \
-X 'github.com/$(org)/$(target).AuthorName=$(authorname)' \
-X 'github.com/$(org)/$(target).AuthorEmail=$(authoremail)' \
-X 'github.com/$(org)/$(target).Copyright=$(copyright)' \
-X 'github.com/$(org)/$(target).License=$(license)' \
-X 'github.com/$(org)/$(target).Name=$(target)'" \
-o $(target) $(gofile)

# install:
# @echo "Installing..."
# sudo cp $(target) /usr/bin/$(target)

build: clean compile

clean:
@echo "Cleaning..."
rm -rvf release/*
rm -rvf $(target)

# test: clean compile install
# test: clean compile
# @echo "Testing..."
# go test -v .

.PHONY: release
release:
mkdir -p release
GOOS="linux" GOARCH="amd64" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-amd64 $(gofile)
GOOS="linux" GOARCH="arm" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-arm $(gofile)
GOOS="linux" GOARCH="arm64" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-arm64 $(gofile)
GOOS="darwin" GOARCH="amd64" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-darwin-amd64 $(gofile)

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# fortios-release

The `fortios-release` is script for creating a better release notes.
You can give the version(s) and it will remove duplicates and change the status
of the bug.

## Instalation from release

- `MacOS`

```bash
wget https://github.com/y0rune/fortios-release/blob/main/release/fortios-release-darwin-amd64 -O fortios-release
chmod +x fortios-release
./fortios-release
```

- `amd64`

```bash
wget https://github.com/y0rune/fortios-release/blob/main/release/fortios-release-darwin-amd64 -O fortios-release
chmod +x fortios-release
./fortios-release
```

- `arm64`

```bash
wget https://github.com/y0rune/fortios-release/blob/main/release/fortios-release-darwin-arm -O fortios-release
chmod +x fortios-release
./fortios-release
```

- `arm`

```bash
wget https://github.com/y0rune/fortios-release/blob/main/release/fortios-release-darwin-amd64 -O fortios-release
chmod +x fortios-release
./fortios-release
```

## Instalation from source

```bash
git clone https://github.com/y0rune/fortios-release.git
go get
make build
```

## Arguments

```
-recordsFile string
Name of the unsorted records from versions (default "records.csv")
-sorted
Get a sorted release notes
-sortedFile string
Name of the sorted output file (default "final.csv")
-version value
Version(s) of the FortiOS
```

## Example of usage

Getting the known and resolved issues in version `7.0.0` and `7.0.1`.

```bash
$ ./fortios-release -version 7.0.0 -version 7.0.1 -recordsFile issues-from-7.0.0-to-7.0.1.csv -sortedFile final.csv -sorted

2022/12/10 13:09:19 Starting gathering links for version 7.0.0
2022/12/10 13:09:21 The knownIssuesUrl is https://docs.fortinet.com/document/fortigate/7.0.0/fortios-release-notes/236526/known-issues
2022/12/10 13:09:21 The resolvedIssuesUrl is https://docs.fortinet.com/document/fortigate/7.0.0/fortios-release-notes/289806/resolved-issues
2022/12/10 13:09:21 Getting the resolved issue for version 7.0.0
2022/12/10 13:09:21 Starting parsing https://docs.fortinet.com/document/fortigate/7.0.0/fortios-release-notes/289806/resolved-issues data to table
2022/12/10 13:09:22 Starting writing the to file issues-from-7.0.0-to-7.0.1.csv
2022/12/10 13:09:22 Getting the known issue for version 7.0.0
2022/12/10 13:09:22 Starting parsing https://docs.fortinet.com/document/fortigate/7.0.0/fortios-release-notes/236526/known-issues data to table
2022/12/10 13:09:22 Starting writing the to file issues-from-7.0.0-to-7.0.1.csv
2022/12/10 13:09:22 Starting gathering links for version 7.0.1
2022/12/10 13:09:23 The knownIssuesUrl is https://docs.fortinet.com/document/fortigate/7.0.1/fortios-release-notes/236526/known-issues
2022/12/10 13:09:23 The resolvedIssuesUrl is https://docs.fortinet.com/document/fortigate/7.0.1/fortios-release-notes/289806/resolved-issues
2022/12/10 13:09:23 Getting the resolved issue for version 7.0.1
2022/12/10 13:09:23 Starting parsing https://docs.fortinet.com/document/fortigate/7.0.1/fortios-release-notes/289806/resolved-issues data to table
2022/12/10 13:09:24 Starting writing the to file issues-from-7.0.0-to-7.0.1.csv
2022/12/10 13:09:24 Getting the known issue for version 7.0.1
2022/12/10 13:09:24 Starting parsing https://docs.fortinet.com/document/fortigate/7.0.1/fortios-release-notes/236526/known-issues data to table
2022/12/10 13:09:25 Starting writing the to file issues-from-7.0.0-to-7.0.1.csv
2022/12/10 13:09:25 Starting writing the to file final.csv
```

All known and resolved issues in version `7.0.0` and `7.0.1`.

```
$ cat issues-from-7.0.0-to-7.0.1.csv | head -n3
BugID,Description,Status,Version
650160,"When using email filter profile, emails are being queued due to IMAP proxy being in stuck state.",resolved,7.0.0
524571,Quarantined files cannot be fetched in the AV log page if the file was already quarantined under another protocol.,resolved,7.0.0
```

Final output

```
$ cat final.csv | head -n3
BugID,Description,Status,Version
650160,"When using email filter profile, emails are being queued due to IMAP proxy being in stuck state.",resolved,7.0.0
524571,Quarantined files cannot be fetched in the AV log page if the file was already quarantined under another protocol.,resolved,7.0.0
```
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module fortiosrelease

go 1.19

require (
github.com/PuerkitoBio/goquery v1.8.0
github.com/hashicorp/go-version v1.6.0
)

require (
github.com/andybalholm/cascadia v1.3.1 // indirect
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI=
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Loading

0 comments on commit 94fdb5e

Please sign in to comment.