Skip to content

Commit

Permalink
Merge pull request #31 from NVIDIA/ghaction
Browse files Browse the repository at this point in the history
Final touches for action v1
  • Loading branch information
ArangoGutierrez authored Mar 5, 2024
2 parents 49a69cc + 70a1337 commit fe5a171
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

build-action:
@rm -rf bin
GOOS=linux $(GO_CMD) build -v -ldflags "-s -w -extldflags '-static'" -o /go/bin/$(BINARY_NAME) cmd/action/main.go
GOOS=linux $(GO_CMD) build -o /go/bin/$(BINARY_NAME) cmd/action/main.go

build-cli:
@rm -rf bin
Expand Down
3 changes: 2 additions & 1 deletion cmd/action/ci/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ func Run(log *logger.FunLogger) error {

func setCfgName(cfg *v1alpha1.Environment) {
sha := os.Getenv("GITHUB_SHA")
attempt := os.Getenv("GITHUB_RUN_ATTEMPT")
// short sha
if len(sha) > 8 {
sha = sha[:8]
}
cfg.Name = fmt.Sprintf("ci-%s", sha)
cfg.Name = fmt.Sprintf("ci%s-%s", attempt, sha)
}
17 changes: 17 additions & 0 deletions cmd/action/ci/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ import (
func cleanup(log *logger.FunLogger) error {
log.Info("Running Cleanup function")

// Map INPUT_AWS_ACCESS_KEY_ID and INPUT_AWS_SECRET_ACCESS_KEY
// to AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
accessKeyID := os.Getenv("INPUT_AWS_ACCESS_KEY_ID")
if accessKeyID == "" {
log.Error(fmt.Errorf("aws access key id not provided"))
os.Exit(1)
}

secretAccessKey := os.Getenv("INPUT_AWS_SECRET_ACCESS_KEY")
if secretAccessKey == "" {
log.Error(fmt.Errorf("aws secret access key not provided"))
os.Exit(1)
}

os.Setenv("AWS_ACCESS_KEY_ID", accessKeyID)
os.Setenv("AWS_SECRET_ACCESS_KEY", secretAccessKey)

configFile := os.Getenv("INPUT_HOLODECK_CONFIG")
if configFile == "" {
log.Error(fmt.Errorf("config file not provided"))
Expand Down

0 comments on commit fe5a171

Please sign in to comment.