Skip to content

Commit

Permalink
pass params via arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
iaftab-alam committed Dec 5, 2024
1 parent 2f507e1 commit 4ac1008
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion tasks/check-stemcell-versions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import (
)

func main() {
if len(os.Args) < 3 {
log.Fatalf("Usage: %s <buildDir> <branchToCompare>", os.Args[0])
}

buildDir := os.Args[1]
branchToCompare := os.Getenv("BRANCH_TO_COMPARE")
branchToCompare := os.Args[2]

content, err := os.ReadFile(filepath.Join(buildDir, "cf-deployment-main", "cf-deployment.yml"))
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions tasks/check-stemcell-versions/task
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ set -eu

function main() {
root_dir="$PWD"
: "${BRANCH_TO_COMPARE:=release-candidate}"
branch_to_compare="${BRANCH_TO_COMPARE:-release-candidate}"

pushd "$(dirname $0)"
BRANCH_TO_COMPARE=$BRANCH_TO_COMPARE go run main.go "${root_dir}"
go run main.go "${root_dir}" "${branch_to_compare}"
popd
}

Expand Down

0 comments on commit 4ac1008

Please sign in to comment.