Skip to content

Commit 2d86482

Browse files
fix: Updated dependencies and added nightly release (#161)
* chore: bump github.com/aws/aws-sdk-go-v2 from 1.32.3 to 1.32.5 Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.32.3 to 1.32.5. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](aws/aws-sdk-go-v2@v1.32.3...v1.32.5) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * chore: bump github.com/aws/aws-sdk-go-v2/credentials Bumps [github.com/aws/aws-sdk-go-v2/credentials](https://github.com/aws/aws-sdk-go-v2) from 1.17.39 to 1.17.46. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](aws/aws-sdk-go-v2@credentials/v1.17.39...credentials/v1.17.46) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/credentials dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * chore: bump github.com/aws/aws-sdk-go-v2/service/lambda Bumps [github.com/aws/aws-sdk-go-v2/service/lambda](https://github.com/aws/aws-sdk-go-v2) from 1.63.0 to 1.69.0. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](aws/aws-sdk-go-v2@service/s3/v1.63.0...service/s3/v1.69.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/service/lambda dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * chore: bump golang.org/x/crypto from 0.28.0 to 0.31.0 (#160) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.28.0 to 0.31.0. - [Commits](golang/crypto@v0.28.0...v0.31.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: bump github.com/aws/aws-sdk-go-v2/config from 1.27.41 to 1.28.5 (#159) Bumps [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) from 1.27.41 to 1.28.5. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](aws/aws-sdk-go-v2@config/v1.27.41...config/v1.28.5) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/config dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * ci: add nightly publishing logic * tests: added test for httpClient * tests: remove env check --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent b2d6295 commit 2d86482

File tree

8 files changed

+272
-123
lines changed

8 files changed

+272
-123
lines changed

.github/workflows/image-prune.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Container Image Cleanup
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Nightly Release"]
6+
types: [completed]
7+
workflow_dispatch:
8+
9+
10+
11+
jobs:
12+
prune:
13+
name: Prune Container Images
14+
runs-on: ubuntu-latest
15+
steps:
16+
17+
- uses: snok/container-retention-policy@v2
18+
with:
19+
image-names: go-lambda-cleanup
20+
cut-off: 1 day ago UTC
21+
timestamp-to-use: created_at
22+
account-type: personal
23+
org-name: karl-cardenas-coding
24+
keep-at-least: 1
25+
skip-tags: nightly
26+
dry-run: false
27+
token-type: github-token
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
31+
- name: Actions Ntfy
32+
run: |
33+
curl \
34+
-u ${{ secrets.NTFY_TOKEN }} \
35+
-H "go-lambda-cleanup Nightly Release" \
36+
-H "X-Tags: warning" \
37+
-H "Markdown: yes" \
38+
-d 'The Nightly Release job failed for go-lambda-cleanup. Check out the GitHub Actions logs for more details.' \
39+
${{ secrets.NTFY_URL }}

.github/workflows/nightly.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Nightly Release
2+
3+
on:
4+
schedule:
5+
# Run every day at 11:00 UTC
6+
- cron: '0 11 * * *'
7+
workflow_dispatch:
8+
9+
10+
env:
11+
GO_VERSION: '1.23'
12+
13+
jobs:
14+
build-and-release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{ env.GO_VERSION }}
26+
check-latest: true
27+
id: go
28+
29+
- name: Generate AWS region file
30+
env:
31+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
run: |
34+
aws ec2 describe-regions --all-regions --region us-east-1 --query "Regions[].RegionName" --output text >> cmd/aws-regions.txt
35+
36+
- name: Update Dependencies
37+
run: go get -u ./...
38+
39+
- name: Execute Go tests
40+
run: make tests
41+
42+
- name: Set up QEMU
43+
uses: docker/[email protected]
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
49+
- name: Login to GHCR
50+
uses: docker/login-action@v3
51+
with:
52+
registry: ghcr.io
53+
username: ${{ github.repository_owner }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: .
60+
build-args: VERSION="nightly"
61+
platforms: linux/amd64,linux/arm64
62+
push: true
63+
tags: ghcr.io/${{ github.repository }}:nightly

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) karl-cardenas-coding
22
# SPDX-License-Identifier: MIT
33

4-
FROM golang:1.23.2-alpine3.20 AS builder
4+
FROM golang:1.23.4-alpine3.21 AS builder
55

66
LABEL org.opencontainers.image.source="http://github.com/karl-cardenas-coding/go-lambda-cleanup"
77
LABEL org.opencontainers.image.description="A solution for removing previous versions of AWS Lambdas"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ build: ## Build the binary file
2323

2424
tests: ## Run tests
2525
@echo "Running tests"
26-
go test -race ./...
26+
go test -shuffle on -race ./...
2727

2828

2929
tests-coverage: ## Start Go Test with code coverage

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
66
[![codecov](https://codecov.io/gh/karl-cardenas-coding/go-lambda-cleanup/graph/badge.svg?token=S8SY4ZA2ZA)](https://codecov.io/gh/karl-cardenas-coding/go-lambda-cleanup)
77
[![Go Report Card](https://goreportcard.com/badge/github.com/karl-cardenas-coding/go-lambda-cleanup/v2)](https://goreportcard.com/report/github.com/karl-cardenas-coding/go-lambda-cleanup/v2)
8+
[![Nighly Build](https://github.com/karl-cardenas-coding/go-lambda-clean-up/actions/workflows/nightly.yaml/badge.svg)](https://github.com/karl-cardenas-coding/go-lambda-cleanup/actions/workflows/nightly.yaml)
89

910

1011
<p align="center">
@@ -57,6 +58,16 @@ time=05/23/22 level=info msg="124 MB of storage space will be removed in an actu
5758
time=05/23/22 level=info msg="Job Duration Time: 1.454406s"
5859
```
5960

61+
### Nightly Release
62+
63+
A nightly release is available as a Docker image. The nightly release is a snapshot of the main branch and automatically updated with the latest minor depedencies updates.
64+
65+
```shell
66+
docker pull ghcr.io/karl-cardenas-coding/go-lambda-cleanup:nightly
67+
```
68+
69+
70+
6071
## Usage
6172

6273
```shell

cmd/root_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ package cmd
55

66
import (
77
"context"
8+
"crypto/tls"
89
"fmt"
10+
"net/http"
911
"os"
1012
"testing"
1113

@@ -371,3 +373,29 @@ func TestNoLambdas(t *testing.T) {
371373

372374
})
373375
}
376+
377+
func TestCreateHTTPClient(t *testing.T) {
378+
379+
client := createHTTPClient()
380+
381+
// Check if the client is not nil
382+
if client == nil {
383+
t.Fatalf("Expected non-nil HTTP client")
384+
}
385+
386+
// Check if the transport is of type *http.Transport
387+
transport, ok := client.Transport.(*http.Transport)
388+
if !ok {
389+
t.Fatalf("Expected transport to be of type *http.Transport, got %T", client.Transport)
390+
}
391+
392+
// Check if the minimum TLS version is set to TLS 1.2
393+
if transport.TLSClientConfig.MinVersion != tls.VersionTLS12 {
394+
t.Errorf("Expected MinVersion to be TLS 1.2, got %v", transport.TLSClientConfig.MinVersion)
395+
}
396+
397+
// Check if ForceAttemptHTTP2 is set to true
398+
if !transport.ForceAttemptHTTP2 {
399+
t.Errorf("Expected ForceAttemptHTTP2 to be true, got %v", transport.ForceAttemptHTTP2)
400+
}
401+
}

go.mod

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,43 @@ module github.com/karl-cardenas-coding/go-lambda-cleanup/v2
33
go 1.23
44

55
require (
6-
github.com/aws/aws-sdk-go-v2 v1.32.3
7-
github.com/aws/aws-sdk-go-v2/config v1.27.41
8-
github.com/aws/aws-sdk-go-v2/credentials v1.17.39
9-
github.com/aws/aws-sdk-go-v2/service/lambda v1.63.0
6+
github.com/aws/aws-sdk-go-v2 v1.32.7
7+
github.com/aws/aws-sdk-go-v2/config v1.28.7
8+
github.com/aws/aws-sdk-go-v2/credentials v1.17.48
9+
github.com/aws/aws-sdk-go-v2/service/lambda v1.69.2
1010
github.com/docker/go-connections v0.5.0
1111
github.com/dustin/go-humanize v1.0.1
1212
github.com/hashicorp/go-version v1.7.0
1313
github.com/sirupsen/logrus v1.9.3
1414
github.com/spf13/cobra v1.8.1
15-
github.com/testcontainers/testcontainers-go v0.33.0
16-
github.com/testcontainers/testcontainers-go/modules/localstack v0.33.0
15+
github.com/testcontainers/testcontainers-go v0.34.0
16+
github.com/testcontainers/testcontainers-go/modules/localstack v0.34.0
1717
gopkg.in/yaml.v3 v3.0.1
1818
)
1919

2020
require (
2121
dario.cat/mergo v1.0.1 // indirect
22-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
22+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
2323
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
2424
github.com/Microsoft/go-winio v0.6.2 // indirect
25-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect
26-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.15 // indirect
27-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 // indirect
28-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 // indirect
25+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect
26+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect
27+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
28+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
2929
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
30-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
31-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.0 // indirect
32-
github.com/aws/aws-sdk-go-v2/service/sso v1.24.0 // indirect
33-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.0 // indirect
34-
github.com/aws/aws-sdk-go-v2/service/sts v1.32.0 // indirect
35-
github.com/aws/smithy-go v1.22.0 // indirect
30+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
31+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect
34+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect
35+
github.com/aws/smithy-go v1.22.1 // indirect
3636
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
3737
github.com/containerd/log v0.1.0 // indirect
3838
github.com/containerd/platforms v0.2.1 // indirect
3939
github.com/cpuguy83/dockercfg v0.3.2 // indirect
40+
github.com/davecgh/go-spew v1.1.1 // indirect
4041
github.com/distribution/reference v0.6.0 // indirect
41-
github.com/docker/docker v27.3.1+incompatible // indirect
42+
github.com/docker/docker v27.4.1+incompatible // indirect
4243
github.com/docker/go-units v0.5.0 // indirect
4344
github.com/felixge/httpsnoop v1.0.4 // indirect
4445
github.com/go-logr/logr v1.4.2 // indirect
@@ -48,9 +49,9 @@ require (
4849
github.com/google/uuid v1.6.0 // indirect
4950
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5051
github.com/jmespath/go-jmespath v0.4.0 // indirect
51-
github.com/klauspost/compress v1.17.10 // indirect
52+
github.com/klauspost/compress v1.17.11 // indirect
5253
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
53-
github.com/magiconair/properties v1.8.7 // indirect
54+
github.com/magiconair/properties v1.8.9 // indirect
5455
github.com/moby/docker-image-spec v1.3.1 // indirect
5556
github.com/moby/patternmatcher v0.6.0 // indirect
5657
github.com/moby/sys/sequential v0.6.0 // indirect
@@ -61,27 +62,30 @@ require (
6162
github.com/opencontainers/go-digest v1.0.0 // indirect
6263
github.com/opencontainers/image-spec v1.1.0 // indirect
6364
github.com/pkg/errors v0.9.1 // indirect
65+
github.com/pmezard/go-difflib v1.0.0 // indirect
6466
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
6567
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
6668
github.com/shoenig/go-m1cpu v0.1.6 // indirect
6769
github.com/spf13/pflag v1.0.5 // indirect
70+
github.com/stretchr/testify v1.10.0 // indirect
6871
github.com/tklauser/go-sysconf v0.3.14 // indirect
6972
github.com/tklauser/numcpus v0.9.0 // indirect
7073
github.com/yusufpapurcu/wmi v1.2.4 // indirect
71-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
72-
go.opentelemetry.io/otel v1.30.0 // indirect
73-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
74-
go.opentelemetry.io/otel/metric v1.30.0 // indirect
75-
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
76-
go.opentelemetry.io/otel/trace v1.30.0 // indirect
77-
golang.org/x/crypto v0.28.0 // indirect
78-
golang.org/x/mod v0.21.0 // indirect
79-
golang.org/x/net v0.30.0 // indirect
80-
golang.org/x/sys v0.26.0 // indirect
81-
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
82-
google.golang.org/genproto/googleapis/api v0.0.0-20240930140551-af27646dc61f // indirect
83-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect
84-
google.golang.org/grpc v1.67.1 // indirect
85-
google.golang.org/protobuf v1.34.2 // indirect
74+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
75+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
76+
go.opentelemetry.io/otel v1.33.0 // indirect
77+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 // indirect
78+
go.opentelemetry.io/otel/metric v1.33.0 // indirect
79+
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
80+
go.opentelemetry.io/otel/trace v1.33.0 // indirect
81+
golang.org/x/crypto v0.31.0 // indirect
82+
golang.org/x/mod v0.22.0 // indirect
83+
golang.org/x/net v0.33.0 // indirect
84+
golang.org/x/sys v0.28.0 // indirect
85+
golang.org/x/time v0.8.0 // indirect
86+
google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect
87+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
88+
google.golang.org/grpc v1.69.2 // indirect
89+
google.golang.org/protobuf v1.36.1 // indirect
8690
gopkg.in/yaml.v2 v2.4.0 // indirect
8791
)

0 commit comments

Comments
 (0)