Debian Codegraph @

crt/s2n/codebuild/bin/utils.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License").
5 # You may not use this file except in compliance with the License.
6 # A copy of the License is located at
7 #
8 # http://aws.amazon.com/apache2.0
9 #
10 # or in the "license" file accompanying this file. This file is distributed
11 # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 # express or implied. See the License for the specific language governing
13 # permissions and limitations under the License.
14 #
15 set -e
16
17 # Utility functions
18 get_latest_releasescip-shell shell shell-project 0.0.0 get_latest_release().(){
19 local LATEST_RELEASE_URL=$(gh api /repos/aws/s2n-tls/releases/latestscip-shell filesystem . . `/repos/aws/s2n-tls/releases/latest`.|jqscip-shell system . . jq. -r '.tarball_url')
20 local LATEST_RELEASE_VER=$(echoscip-shell system . . echo. "${LATEST_RELEASE_URL}" | sedscip-shell system . . sed. 's|.*/||')
21 echoscip-shell system . . echo. "${LATEST_RELEASE_VER}"
22 }
23
24 gh_loginscip-shell shell shell-project 0.0.0 gh_login().(){
25 # Takes secrets manager key as an argument
26 # This GH personal access token must have 'repo' permissions to work.
27 gh auth status || aws secretsmanager get-secret-value --secret-id "$1" --query 'SecretString' --output text |jqscip-shell system . . jq. -r '.secret_key'| gh auth login --with-token
28
29 #gh auth status
30 }
31
32 criterion_install_depsscip-shell shell shell-project 0.0.0 criterion_install_deps().(){
33 makescip-shell system . . make. install
34 source "$HOME"/.cargo/env
35 makescip-shell system . . make. -C bindings/rust
36 }
37
38
39 usagescip-shell shell shell-project 0.0.0 usage().(){
40 echoscip-shell system . . echo. -e "Usage:\n\tget_latest_release: returns just the latest v.N.N.N version"
41 echoscip-shell system . . echo. -e "\tgh_login <Secret Name> : retrieves a GitHub PAT from secrets manager and logs into GitHub.\n"
42 }
43
44 if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
45 case "${1:-}" in
46 "gh_login")
47 gh_loginscip-shell shell shell-project 0.0.0 gh_login(). "${2:-}";;
48 "get_latest_release")
49 get_latest_releasescip-shell shell shell-project 0.0.0 get_latest_release().
50 echoscip-shell system . . echo. "$LATEST_RELEASE_VER";;
51 *) usagescip-shell shell shell-project 0.0.0 usage().;
52 esac
53 fi