Skip to content

Commit a3f1f2b

Browse files
committed
fix: upgrade aws sdk and modernize docker/helm github actions
1 parent 461f902 commit a3f1f2b

File tree

11 files changed

+138
-143
lines changed

11 files changed

+138
-143
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
.github
3+
.idea
4+
binaries
5+
tmp
6+
reports
7+
*.tgz
8+
AGENTS.md

.github/workflows/docker.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- altinity
9+
- 'release-*'
10+
tags:
11+
- 'v*'
12+
pull_request:
13+
branches:
14+
- main
15+
- altinity
16+
17+
env:
18+
REGISTRY: docker.io
19+
IMAGE_NAME: altinity/transferia
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up QEMU
32+
uses: docker/setup-qemu-action@v3
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
- name: Log in to Docker Hub
38+
if: github.event_name != 'pull_request'
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ secrets.DOCKER_USERNAME }}
43+
password: ${{ secrets.DOCKER_PASSWORD }}
44+
45+
- name: Extract metadata (tags, labels)
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
50+
tags: |
51+
type=ref,event=branch
52+
type=ref,event=pr
53+
type=semver,pattern={{version}}
54+
type=semver,pattern={{major}}.{{minor}}
55+
type=semver,pattern={{major}}
56+
type=sha,prefix=
57+
type=raw,value=latest,enable={{is_default_branch}}
58+
59+
- name: Build and push Docker image
60+
uses: docker/build-push-action@v6
61+
with:
62+
context: .
63+
platforms: linux/amd64,linux/arm64
64+
push: ${{ github.event_name != 'pull_request' }}
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max
Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,56 @@
1-
name: Release Helm Chart
1+
name: Package and Push Helm Chart
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- altinity
58
paths:
69
- 'helm/transfer/**'
10+
- '.github/workflows/release-chart.yml'
711

812
pull_request:
13+
branches:
14+
- main
15+
- altinity
916
paths:
1017
- 'helm/transfer/**'
18+
- '.github/workflows/release-chart.yml'
19+
20+
env:
21+
REGISTRY: ghcr.io
22+
OCI_REPO: transferia/transferia-helm
1123

1224
jobs:
13-
publish:
25+
helm:
1426
runs-on: ubuntu-latest
27+
if: github.event_name != 'pull_request'
28+
permissions:
29+
contents: read
30+
packages: write
1531

1632
steps:
1733
- name: Checkout repository
18-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
35+
36+
- name: Log in to Container Registry
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
1942

2043
- name: Set up Helm
21-
uses: azure/setup-helm@v3
44+
uses: azure/setup-helm@v4
45+
with:
46+
version: latest
47+
48+
- name: Package Helm chart
49+
run: |
50+
helm package ./helm/transfer
51+
ls -la transfer-*.tgz
2252
23-
- name: Package helm
24-
env:
25-
GITHUB_USERNAME: laskoviymishka
26-
GHCR_TOKEN: ${{ secrets.GH_HELM_PAT }}
27-
HELM_EXPERIMENTAL_OCI: 1
53+
- name: Push Helm chart to OCI registry
2854
run: |
29-
make helm-push
30-
make clean
55+
CHART_VERSION=$(helm show chart ./helm/transfer | grep '^version:' | awk '{print $2}')
56+
helm push transfer-${CHART_VERSION}.tgz oci://${{ env.REGISTRY }}/${{ env.OCI_REPO }}

.github/workflows/release-docker-branch.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/release-docker-latest.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/release-docker.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

Dockerfile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
FROM golang:1.24.6-alpine3.22 AS builder
2+
3+
WORKDIR /src
4+
5+
ARG TARGETOS
6+
ARG TARGETARCH
7+
8+
RUN apk add --no-cache git ca-certificates
9+
10+
COPY . .
11+
12+
RUN go mod download
13+
14+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -o /out/trcli ./cmd/trcli
15+
116
FROM alpine:3.22
217

318
# Environment variables
@@ -17,12 +32,12 @@ RUN apk add --no-cache \
1732
dirmngr \
1833
nano \
1934
vim \
20-
busybox-extras \
35+
busybox-extras \
2136
less \
2237
tcpdump \
2338
net-tools \
2439
lsof \
25-
libaio \
40+
libaio \
2641
unzip \
2742
git && \
2843
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
@@ -64,8 +79,8 @@ RUN chmod +x /usr/local/bin/install-clickhouse.sh && /usr/local/bin/install-clic
6479
RUN addgroup -S trcligroup && \
6580
adduser -S -G trcligroup trcliuser
6681

67-
# Copy the Go binary
68-
COPY trcli /usr/local/bin/trcli
82+
# Copy the Go binary built for the target platform
83+
COPY --from=builder /out/trcli /usr/local/bin/trcli
6984

7085
# Set executable permission
7186
RUN chmod +x /usr/local/bin/trcli

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ API ?= trcli
1313
build:
1414
go build -o binaries/$(API) ./cmd/trcli/*.go
1515

16-
docker: build
17-
cp binaries/$(API) . && docker build -t transfer
16+
.PHONY: docker
17+
docker:
18+
docker build -t transfer .
1819

1920
.PHONY: test
2021
test:

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/alecthomas/participle v0.4.1
1616
github.com/antlr4-go/antlr/v4 v4.13.1
1717
github.com/araddon/dateparse v0.0.0-20190510211750-d2ba70357e92
18-
github.com/aws/aws-sdk-go v1.55.6
18+
github.com/aws/aws-sdk-go v1.55.8
1919
github.com/blang/semver/v4 v4.0.0
2020
github.com/brianvoe/gofakeit/v6 v6.28.0
2121
github.com/cenkalti/backoff/v4 v4.3.0
@@ -312,8 +312,6 @@ replace go.temporal.io/server => go.temporal.io/server v1.27.2
312312

313313
replace github.com/jackc/pgtype => github.com/jackc/pgtype v1.12.0
314314

315-
replace github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.46.7
316-
317315
replace k8s.io/api => k8s.io/api v0.26.1
318316

319317
replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.26.1

0 commit comments

Comments
 (0)