Skip to content

Commit

Permalink
write images everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Rumney committed Sep 13, 2021
1 parent 2790bd9 commit 2a466d0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Expand Up @@ -54,8 +54,8 @@ jobs:
username: ${{ secrets.TFSEC_DOCKERHUB_USER }}
password: ${{ secrets.TFSEC_DOCKERHUB_TOKEN }}

- name: Tfsec image building
run: make clone-image
- name: Tfsec image building for docker tfsec
run: make clone-image-tfsec


# temporary hack to copy over the aquasec images to github packages
Expand All @@ -64,7 +64,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Tfsec image building
run: make clone-image
- name: Tfsec image building for github
run: make clone-image-github
10 changes: 7 additions & 3 deletions Makefile
Expand Up @@ -66,9 +66,13 @@ fix-typos:
which codespell || pip install codespell
codespell -S vendor,funcs,.terraform --ignore-words .codespellignore -f -w -i1

.PHONY: clone-image
clone-image:
./scripts/clone-images.sh
.PHONY: clone-image-github
clone-image-github:
./scripts/clone-images.sh ghcr.io/aquasecurity

.PHONY: clone-image-tfsec
clone-image-tfsec:
./scripts/clone-images.sh tfsec

.PHONY: sanity
sanity: test
Expand Down
16 changes: 9 additions & 7 deletions scripts/clone-images.sh
@@ -1,24 +1,26 @@
#!/bin/bash

set -x

function clone_image() {

IMAGE=$1
OWNER=$2

if [ -z $IMAGE ]; then
echo "You need to provide an image name, exiting"
exit 1
fi

docker tag aquasec/$IMAGE tfsec/$IMAGE
echo "pushing tfsec/${IMAGE}"
docker push tfsec/$IMAGE
docker tag aquasec/$IMAGE aquasecurity/$IMAGE
echo "pushing aquasecurity/${IMAGE}"
docker push aquasecurity/$IMAGE
docker tag aquasec/${IMAGE} ${OWNER}/${IMAGE}
echo "pushing ${OWNER}/${IMAGE}"
docker push ${OWNER}/${IMAGE}
}

OWNER=$1

RESULTS=$(docker image list --format {{.Repository}}:{{.Tag}} | grep aquasec/tfsec | awk -F/ '{print $2}')

for RESULT in $RESULTS; do
clone_image $RESULT
clone_image $RESULT $OWNER
done
2 changes: 1 addition & 1 deletion vendor/modules.txt
Expand Up @@ -217,7 +217,7 @@ github.com/spf13/pflag
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
# github.com/zclconf/go-cty v1.9.1
## explicit
## explicit; go 1.12
github.com/zclconf/go-cty/cty
github.com/zclconf/go-cty/cty/convert
github.com/zclconf/go-cty/cty/function
Expand Down

0 comments on commit 2a466d0

Please sign in to comment.