diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8473f1975..6e1b0b437 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -278,6 +278,18 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 1 + + - uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk + role-session-name: cipush + aws-region: eu-central-1 + + - uses: aws-actions/amazon-ecr-login@v1 + id: ecr + with: + mask-password: 'true' + - name: Run ci/tests shell: bash env: @@ -296,7 +308,7 @@ jobs: echo Attempting to test $d if [ -d $d ] && [ -e $d/test.sh ]; then cd $d - ./test.sh ${{ needs.goreleaser.outputs.tag }} + ./test.sh ${{ steps.ecr.outputs.registry }}/tyk-pump:sha-${{ github.sha }} cd - fi done @@ -305,7 +317,7 @@ jobs: echo Attempting to test $d if [ -d $d ] && [ -e $d/test.sh ]; then cd $d - ./test.sh ${{ needs.goreleaser.outputs.tag }} + ./test.sh ${{ steps.ecr.outputs.registry }}/tyk-pump:sha-${{ github.sha }} cd - fi done diff --git a/ci/tests/csvpump/docker-compose.yml b/ci/tests/csvpump/docker-compose.yml index a11a677a3..6753e6a16 100644 --- a/ci/tests/csvpump/docker-compose.yml +++ b/ci/tests/csvpump/docker-compose.yml @@ -24,7 +24,7 @@ services: timeout: 10s pump: - image: tykio/tyk-pump-docker-pub:${tag} + image: ${pump_image} volumes: - ./confs/tyk-pump.conf:/conf/tyk-pump.conf - /tmp/pump-data:/pump-data diff --git a/ci/tests/csvpump/test.sh b/ci/tests/csvpump/test.sh index 056235bba..029decfce 100755 --- a/ci/tests/csvpump/test.sh +++ b/ci/tests/csvpump/test.sh @@ -36,7 +36,7 @@ function warn { DEFAULT_GW_TAG=v4.0.1 [[ -z $1 ]] && usage "$0" -export tag=$1 +export pump_image=$1 export gwtag=$2 if [[ -z $2 ]]; then diff --git a/main.go b/main.go index f71e87945..31bdb2818 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,7 @@ var log = logger.GetLogger() var mainPrefix = "main" var ( + //lint:ignore U1000 Function is used when version flag is passed in command line help = kingpin.CommandLine.HelpFlag.Short('h') conf = kingpin.Flag("conf", "path to the config file").Short('c').Default("pump.conf").String() demoMode = kingpin.Flag("demo", "pass orgID string to generate demo data").Default("").String() @@ -45,7 +46,8 @@ var ( demoRecordsPerHour = kingpin.Flag("demo-records-per-hour", "flag that determines the number of records per hour for the analytics records").Default("0").Int() demoFutureData = kingpin.Flag("demo-future-data", "flag that determines if the demo data should be in the future").Default("false").Bool() debugMode = kingpin.Flag("debug", "enable debug mode").Bool() - version = kingpin.Version(pumps.VERSION) + //lint:ignore U1000 Function is used when version flag is passed in command line + version = kingpin.Version(pumps.Version) ) func Init() { @@ -69,7 +71,7 @@ func Init() { log.WithFields(logrus.Fields{ "prefix": mainPrefix, - }).Info("## Tyk Pump, ", pumps.VERSION, " ##") + }).Info("## Tyk Pump, ", pumps.Version, " ##") // If no environment variable is set, check the configuration file: if os.Getenv("TYK_LOGLEVEL") == "" { @@ -123,7 +125,12 @@ func storeVersion() { versionStore.KeyPrefix = "version-check-" versionStore.Config = versionConf versionStore.Connect() - versionStore.SetKey("pump", pumps.VERSION, 0) + err := versionStore.SetKey("pump", pumps.Version, 0) + if err != nil { + log.WithFields(logrus.Fields{ + "prefix": mainPrefix, + }).Error("Error storing version: ", err) + } } func initialisePumps() { diff --git a/pumps/version.go b/pumps/version.go index 444d3697b..119270cfb 100644 --- a/pumps/version.go +++ b/pumps/version.go @@ -1,6 +1,8 @@ package pumps var ( - VERSION = "v1.8.0" - builtBy, Commit, buildDate string + Version = "v1.8.0" + BuiltBy string + Commit string + BuildDate string )