From 9d4333a6f658f7edfd163b1e2d63c438b096a5c6 Mon Sep 17 00:00:00 2001 From: Matt Jadud Date: Sat, 2 Mar 2024 08:49:20 -0500 Subject: [PATCH] Trying to make the version a variable. --- .github/workflows/build_go.yml | 12 +++++++++--- internal/pipes/mc.go | 8 -------- internal/pipes/s3.go | 10 +--------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_go.yml b/.github/workflows/build_go.yml index f4ae8be..d294cba 100644 --- a/.github/workflows/build_go.yml +++ b/.github/workflows/build_go.yml @@ -3,6 +3,9 @@ name: Go +env: + go_version: '1.20' + on: push: branches: [ "main" ] @@ -19,7 +22,8 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: ${{ env.go_version }} + - name: Install dependencies run: | go get . @@ -35,8 +39,10 @@ jobs: - name: Test run: go test -v ./... + - name: Test with Go + run: go test -json > test_results-${{ env.go-version }}.json - name: Upload Go test results uses: actions/upload-artifact@v4 with: - name: go-results-${{ matrix.go-version }} - path: test-results-${{ matrix.go-version }}.json + name: go_results-${{ env.go-version }} + path: test_results-${{ env.go-version }}.json diff --git a/internal/pipes/mc.go b/internal/pipes/mc.go index 34bc7d0..450d640 100644 --- a/internal/pipes/mc.go +++ b/internal/pipes/mc.go @@ -11,14 +11,6 @@ import ( "gov.gsa.fac.backups/internal/vcap" ) -// export AWS_PRIVATE_ACCESS_KEY_ID=longtest -// export AWS_PRIVATE_SECRET_ACCESS_KEY=longtest -// export AWS_S3_PRIVATE_ENDPOINT="http://minio:9000" -// mc alias set myminio "${AWS_S3_PRIVATE_ENDPOINT}" minioadmin minioadmin -// # Do nothing if the bucket already exists. -// # https: //min.io/docs/minio/linux/reference/minio-mc/mc-mb.html -// mc mb --ignore-existing myminio/gsa-fac-private-s3 - // https://bitfieldconsulting.com/golang/scripting func Mc(in_pipe *script.Pipe, upc vcap.UserProvidedCredentials, prefix string, source_db string) *script.Pipe { // // mc pipe myminio/gsa-fac-private-s3/backups/${PREFIX}-${FROM_DATABASE}.dump diff --git a/internal/pipes/s3.go b/internal/pipes/s3.go index f21f0aa..cf83fe5 100644 --- a/internal/pipes/s3.go +++ b/internal/pipes/s3.go @@ -10,19 +10,11 @@ import ( "gov.gsa.fac.backups/internal/vcap" ) -// export AWS_PRIVATE_ACCESS_KEY_ID=longtest -// export AWS_PRIVATE_SECRET_ACCESS_KEY=longtest -// export AWS_S3_PRIVATE_ENDPOINT="http://minio:9000" -// mc alias set myminio "${AWS_S3_PRIVATE_ENDPOINT}" minioadmin minioadmin -// # Do nothing if the bucket already exists. -// # https: //min.io/docs/minio/linux/reference/minio-mc/mc-mb.html -// mc mb --ignore-existing myminio/gsa-fac-private-s3 - // https://bitfieldconsulting.com/golang/scripting func S3(in_pipe *script.Pipe, up *vcap.CredentialsS3, prefix string, source_db string) *script.Pipe { os.Setenv("ACCESS_KEY_ID", up.AccessKeyId) os.Setenv("SECRET_ACCESS_KEY", up.SecretAccessKey) - + // https://serverfault.com/questions/886562/streaming-postgresql-pg-dump-to-s3 cmd := []string{ "s3", "cp",