Skip to content

Commit

Permalink
Merge branch 'main' into oreilly-main
Browse files Browse the repository at this point in the history
  • Loading branch information
swhite-oreilly committed Oct 24, 2023
2 parents 54c1ff9 + 4d35ec1 commit 2db209d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
go install golang.org/x/lint/golint@latest
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check Formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
Expand Down
48 changes: 47 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Project binaries
Expand All @@ -31,3 +31,49 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
file_glob: true

docker_build:
runs-on: ubuntu-22.04
name: Docker Build

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate image tags
shell: bash
run: echo "tags=quay.io/rebuy/aws-nuke:${GITHUB_REF#refs/tags/},docker.io/rebuy/aws-nuke:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
id: generate_tags

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.generate_tags.outputs.tags }}
platforms: linux/amd64,linux/arm64
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/rebuy-de/aws-nuke/v2
go 1.21

require (
github.com/aws/aws-sdk-go v1.44.328
github.com/aws/aws-sdk-go v1.45.26
github.com/fatih/color v1.15.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.1
Expand All @@ -13,7 +13,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
golang.org/x/sync v0.3.0
golang.org/x/sync v0.4.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/aws/aws-sdk-go v1.44.328 h1:WBwlf8ym9SDQ/GTIBO9eXyvwappKJyOetWJKl4mT7ZU=
github.com/aws/aws-sdk-go v1.44.328/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.45.26 h1:PJ2NJNY5N/yeobLYe1Y+xLdavBi67ZI8gvph6ftwVCg=
github.com/aws/aws-sdk-go v1.45.26/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -75,8 +75,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
9 changes: 9 additions & 0 deletions resources/opensearchservice-packages.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package resources

import (
"fmt"
"strings"
"time"

"github.com/aws/aws-sdk-go/aws/session"
Expand Down Expand Up @@ -54,6 +56,13 @@ func ListOSPackages(sess *session.Session) ([]Resource, error) {
return resources, nil
}

func (o *OSPackage) Filter() error {
if strings.HasPrefix(*o.packageID, "G") {
return fmt.Errorf("cannot delete default opensearch packages")
}
return nil
}

func (o *OSPackage) Remove() error {
_, err := o.svc.DeletePackage(&opensearchservice.DeletePackageInput{
PackageID: o.packageID,
Expand Down

0 comments on commit 2db209d

Please sign in to comment.