Skip to content

Commit

Permalink
Feat/upgrade gaf to include stella whitelist (#4860)
Browse files Browse the repository at this point in the history
* feat: upgrade gaf to include stella whitelist

* feat: added script to upgrade go application framework
  • Loading branch information
robh-snyk authored Sep 19, 2023
1 parent d37cfd6 commit 2357979
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@ You may see some "Docker Hub" checks on your merge commit fail. This is normal a

After the `release-npm` job successfully completes, an automated process generates the Docker images for Snyk CLI. These images are then published to DockerHub under the repository [`snyk/snyk`](https://hub.docker.com/r/snyk/snyk).

## Upgrading the go-application-framework

If you have made changes to the `go-application-framework`, you can run `python3 scripts/upgrade-go-application-framework.py`. This will;

- Fetch the most recent commit from master of the framework
- Go get that version of the framework

You can then raise a pr with the relevant changes.

---

Questions? Ask Hammerhead 🔨
2 changes: 1 addition & 1 deletion cliv2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/snyk/cli-extension-iac-rules v0.0.0-20230601153200-c572cfce46ce
github.com/snyk/cli-extension-sbom v0.0.0-20230831113416-7ffac8738181
github.com/snyk/container-cli v0.0.0-20230913123839-91b568e2fbd7
github.com/snyk/go-application-framework v0.0.0-20230911124155-af80929f69be
github.com/snyk/go-application-framework v0.0.0-20230915105125-18e4f97ef870
github.com/snyk/go-httpauth v0.0.0-20230726132335-d454674305a7
github.com/snyk/snyk-iac-capture v0.6.0
github.com/snyk/snyk-ls v0.0.0-20230911152618-39fc0f68d431
Expand Down
4 changes: 2 additions & 2 deletions cliv2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ github.com/snyk/cli-extension-sbom v0.0.0-20230831113416-7ffac8738181 h1:BMiPwr4
github.com/snyk/cli-extension-sbom v0.0.0-20230831113416-7ffac8738181/go.mod h1:O/cjwCbKhJQWyXHPmNbZ7ToQKnhyw0VUp1Qhim3WEcw=
github.com/snyk/container-cli v0.0.0-20230913123839-91b568e2fbd7 h1:mDQr5bRNaJoUVuqI6kwuOUBXXYT1B4JTKzbrzikjvdE=
github.com/snyk/container-cli v0.0.0-20230913123839-91b568e2fbd7/go.mod h1:38w+dcAQp9eG3P5t2eNS9eG0reut10AeJjLv5lJ5lpM=
github.com/snyk/go-application-framework v0.0.0-20230911124155-af80929f69be h1:xmZbwbrAxNeU0v8Le+cJGMGt75ziAf68YVFdw6hryk8=
github.com/snyk/go-application-framework v0.0.0-20230911124155-af80929f69be/go.mod h1:kuw/MMZ4rnQYMVGDTIkoJGyEEAl0DoHqEN6ZiYbNbSA=
github.com/snyk/go-application-framework v0.0.0-20230915105125-18e4f97ef870 h1:R8xLYCVSC8aBVWlIevP4tBOHFdUr6UzWNYzuZqAEzJE=
github.com/snyk/go-application-framework v0.0.0-20230915105125-18e4f97ef870/go.mod h1:kuw/MMZ4rnQYMVGDTIkoJGyEEAl0DoHqEN6ZiYbNbSA=
github.com/snyk/go-httpauth v0.0.0-20230726132335-d454674305a7 h1:m8C34vcouY2vEvow2gV/uAZ0LKiV7vhwC5HI15nUDX4=
github.com/snyk/go-httpauth v0.0.0-20230726132335-d454674305a7/go.mod h1:88KbbvGYlmLgee4OcQ19yr0bNpXpOr2kciOthaSzCAg=
github.com/snyk/policy-engine v0.22.0 h1:od9pduGrXyfWO791X+8M1qmnvWUxaIXh0gBzGKqeseA=
Expand Down
24 changes: 24 additions & 0 deletions scripts/upgrade-go-application-framework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import requests
import subprocess

def get_latest_commit_sha():
url = f"https://api.github.com/repos/snyk/go-application-framework/commits"
headers = {
"Accept": "application/vnd.github.v3+json",
}
response = requests.get(url, headers=headers)
response.raise_for_status()
commits = response.json()
return commits[0]['sha']

def upgrade_go_application_framework(commit_sha):
subprocess.run(['go', 'get', '-u', f'github.com/snyk/go-application-framework@{commit_sha}'], cwd='./cliv2', check=True)
subprocess.run(['go', 'mod', 'tidy'], cwd='./cliv2', check=True)

if __name__ == "__main__":
try:
commit_sha = get_latest_commit_sha()
print(f"The most recent commit SHA for `go-application-framework` is: {commit_sha}")
upgrade_go_application_framework(commit_sha)
except Exception as e:
print(f"An error occurred: {e}")

0 comments on commit 2357979

Please sign in to comment.