Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECT-1803 Security Updates #7

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docker_push.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

VERSION="1.2.5"
set -e

VERSION="$(git describe --tags --match 'v*')" # Get version tag from git
Copy link

@hedayat hedayat Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking maybe its better to have a more specific match pattern; at least making sure that 'v' is followed by a number. If we think there might be non-version tags, it's likely that a tag can be a word starting with 'v'.

Suggested change
VERSION="$(git describe --tags --match 'v*')" # Get version tag from git
VERSION="$(git describe --tags --match 'v[[:digit:]]*')" # Get version tag from git

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, didn't see this until now. The match flag takes a glob, not a regex.

--match <pattern>
           Only consider tags matching the given glob(7) pattern, excluding the "refs/tags/" prefix.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late comment. Yeah, if it was a regex we could actually match the complete version pattern. But, that's also a glob pattern to just match the first character of the tag after 'v' to be a number. According to 'man 7 glob', the [[:digit:]] pattern is also recognized, so I used it instead of [0-9] range.

VERSION=${VERSION#v} # Remove leading 'v'

read -p "This action will build and publish docker image version $VERSION (this will automatically proceed in 15 seconds)" -t 15 || true

docker buildx build --sbom=false --provenance=false --platform linux/amd64,linux/arm64/v8 --push -t 064061306967.dkr.ecr.us-west-2.amazonaws.com/acceptto/local-reverse-geocoder:$VERSION .