Skip to content

Commit ea07a10

Browse files
Merge pull request #10 from oreillymedia/Update-comprehend-detection-filters
Updating detection filters and bringing in rebuy main changes.
2 parents cf3c7e4 + b598367 commit ea07a10

File tree

71 files changed

+1784
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1784
-177
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ updates:
99
day: "tuesday"
1010
time: "10:00"
1111
timezone: "Europe/Berlin"
12+
groups:
13+
golang:
14+
patterns:
15+
- "*"

.github/workflows/ci.yaml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,77 @@ jobs:
1616
- name: Setup Go
1717
uses: actions/setup-go@v3
1818
with:
19-
go-version: '1.20'
19+
go-version: '1.21'
2020
- name: Setup tools
2121
run: |
2222
go install golang.org/x/lint/golint@latest
2323
- name: Checkout code
2424
uses: actions/checkout@v3
25+
- name: Check Formatting
26+
run: |
27+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
28+
echo "### Go formatting is off, please execute 'gofmt -w -s .' - see following diff: ###"
29+
gofmt -s -d .
30+
exit 1
31+
fi
2532
- name: Test Project
2633
run: |
2734
make test
2835
- name: Build Project
2936
run: |
3037
make
38+
39+
docker_build:
40+
runs-on: ubuntu-22.04
41+
name: Docker Build
42+
if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == 'rebuy-de/aws-nuke' && github.event.pull_request.user.login != 'dependabot[bot]')
43+
44+
steps:
45+
- uses: actions/checkout@v3
46+
with:
47+
fetch-depth: 0
48+
49+
- name: Generate image tags
50+
shell: bash
51+
run: |
52+
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
53+
BRANCH="$(echo ${GITHUB_HEAD_REF} | tr '/' '_')"
54+
echo "tags=quay.io/rebuy/aws-nuke:${BRANCH},docker.io/rebuy/aws-nuke:${BRANCH}" >> $GITHUB_OUTPUT
55+
else
56+
echo "tags=quay.io/rebuy/aws-nuke:main,docker.io/rebuy/aws-nuke:main,\
57+
quay.io/rebuy/aws-nuke:latest,docker.io/rebuy/aws-nuke:latest" >> $GITHUB_OUTPUT
58+
fi
59+
id: generate_tags
60+
61+
- name: Set up QEMU
62+
if: github.event_name != 'pull_request'
63+
id: qemu
64+
uses: docker/setup-qemu-action@v2
65+
with:
66+
platforms: arm64
67+
68+
- name: Set up Docker Buildx
69+
uses: docker/setup-buildx-action@v2
70+
with:
71+
install: true
72+
73+
- name: Login to Docker Hub
74+
uses: docker/login-action@v2
75+
with:
76+
username: ${{ secrets.DOCKER_USERNAME }}
77+
password: ${{ secrets.DOCKER_PASSWORD }}
78+
79+
- name: Login to Quay.io
80+
uses: docker/login-action@v2
81+
with:
82+
registry: quay.io
83+
username: ${{ secrets.QUAY_USERNAME }}
84+
password: ${{ secrets.QUAY_PASSWORD }}
85+
86+
- name: Build and push
87+
uses: docker/build-push-action@v3
88+
with:
89+
context: .
90+
push: true
91+
tags: ${{ steps.generate_tags.outputs.tags }}
92+
platforms: ${{ github.event_name != 'pull_request' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup Go
1414
uses: actions/setup-go@v3
1515
with:
16-
go-version: '1.20'
16+
go-version: '1.21'
1717
- name: Checkout code
1818
uses: actions/checkout@v3
1919
with:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20-alpine as builder
1+
FROM golang:1.21-alpine as builder
22

33
RUN apk add --no-cache git make curl openssl
44

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,10 @@ The easiest way of installing it, is to download the latest
612612
#### Example for Linux Intel/AMD
613613

614614
Download and extract
615-
`$ wget -c https://github.com/rebuy-de/aws-nuke/releases/download/v2.23.0/aws-nuke-v2.23.0-linux-amd64.tar.gz -O - | tar -xz -C $HOME/bin`
615+
`$ wget -c https://github.com/rebuy-de/aws-nuke/releases/download/v2.24.2/aws-nuke-v2.24.2-linux-amd64.tar.gz -O - | tar -xz -C $HOME/bin`
616616

617617
Run
618-
`$ aws-nuke-v2.23.0-linux-amd64`
618+
`$ aws-nuke-v2.24.2-linux-amd64`
619619

620620
### Compile from Source
621621

@@ -639,7 +639,7 @@ $ docker run \
639639
--rm -it \
640640
-v /full-path/to/nuke-config.yml:/home/aws-nuke/config.yml \
641641
-v /home/user/.aws:/home/aws-nuke/.aws \
642-
quay.io/rebuy/aws-nuke:v2.23.0 \
642+
quay.io/rebuy/aws-nuke:v2.24.2 \
643643
--profile default \
644644
--config /home/aws-nuke/config.yml
645645
```

cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ func NewRootCommand() *cobra.Command {
6969
awsutil.DefaultAWSPartitionID = endpoints.AwsPartitionID
7070
case endpoints.UsGovEast1RegionID, endpoints.UsGovWest1RegionID:
7171
awsutil.DefaultAWSPartitionID = endpoints.AwsUsGovPartitionID
72+
case endpoints.CnNorth1RegionID, endpoints.CnNorthwest1RegionID:
73+
awsutil.DefaultAWSPartitionID = endpoints.AwsCnPartitionID
7274
default:
7375
if config.CustomEndpoints.GetRegion(defaultRegion) == nil {
7476
err = fmt.Errorf("The custom region '%s' must be specified in the configuration 'endpoints'", defaultRegion)

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/rebuy-de/aws-nuke/v2
22

3-
go 1.19
3+
go 1.21
44

55
require (
6-
github.com/aws/aws-sdk-go v1.44.295
6+
github.com/aws/aws-sdk-go v1.44.328
77
github.com/fatih/color v1.15.0
88
github.com/golang/mock v1.6.0
9-
github.com/google/uuid v1.3.0
9+
github.com/google/uuid v1.3.1
1010
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4
1111
github.com/pkg/errors v0.9.1
1212
github.com/rebuy-de/rebuy-go-sdk/v4 v4.5.1

go.sum

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/aws/aws-sdk-go v1.44.295 h1:SGjU1+MqttXfRiWHD6WU0DRhaanJgAFY+xIhEaugV8Y=
2-
github.com/aws/aws-sdk-go v1.44.295/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
1+
github.com/aws/aws-sdk-go v1.44.328 h1:WBwlf8ym9SDQ/GTIBO9eXyvwappKJyOetWJKl4mT7ZU=
2+
github.com/aws/aws-sdk-go v1.44.328/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
33
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
44
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
55
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -11,8 +11,8 @@ github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0 h1:SLtCnpI5ZZaz4l7RSatEhppB1B
1111
github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0/go.mod h1:wi1zWv9tIvyLSMLCAzgRP+YR24oLVQVBHfPPKjtht44=
1212
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
1313
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
14-
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
15-
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
14+
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
15+
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1616
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
1717
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
1818
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
@@ -71,6 +71,7 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
7171
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
7272
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
7373
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
74+
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
7475
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
7576
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
7677
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -98,6 +99,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
9899
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
99100
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
100101
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
102+
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
101103
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
102104
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
103105
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
@@ -112,6 +114,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
112114
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
113115
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
114116
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
117+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
115118
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
116119
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
117120
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

pkg/config/filter.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ func parseDate(input string) (time.Time, error) {
8484
return t, nil
8585
}
8686

87-
formats := []string{"2006-01-02",
87+
formats := []string{
88+
"2006-01-02",
8889
"2006/01/02",
8990
"2006-01-02T15:04:05Z",
90-
"2006-01-02 15:04:05.000 -0700 MST", // Date format used by AWS for CreateTime on ASGs
91-
time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON()
91+
"2006-01-02 15:04:05 -0700 MST", // Date format used by AWS for CreateTime on ASGs
92+
time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON()
9293
time.RFC3339,
9394
}
9495
for _, f := range formats {

pkg/config/filter_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,22 @@ func TestUnmarshalFilter(t *testing.T) {
4848
},
4949
{
5050
yaml: `{"type":"dateOlderThan","value":"0"}`,
51-
match: []string{strconv.Itoa(int(future.Unix())),
51+
match: []string{
52+
strconv.Itoa(int(future.Unix())),
5253
future.Format("2006-01-02"),
5354
future.Format("2006/01/02"),
5455
future.Format("2006-01-02T15:04:05Z"),
56+
future.Format("2006-01-02 15:04:05.000 +0000 UTC"),
5557
future.Format(time.RFC3339Nano),
5658
future.Format(time.RFC3339),
5759
},
58-
mismatch: []string{"",
60+
mismatch: []string{
61+
"",
5962
strconv.Itoa(int(past.Unix())),
6063
past.Format("2006-01-02"),
6164
past.Format("2006/01/02"),
6265
past.Format("2006-01-02T15:04:05Z"),
66+
past.Format("2006-01-02 15:04:05.14 -0700 MST"),
6367
past.Format(time.RFC3339Nano),
6468
past.Format(time.RFC3339),
6569
},
@@ -98,5 +102,4 @@ func TestUnmarshalFilter(t *testing.T) {
98102
}
99103
})
100104
}
101-
102105
}

0 commit comments

Comments
 (0)