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

Add HUB_COMPONENT_DIR implicit variable for deployment hooks #23

Open
akranga opened this issue Jan 19, 2023 · 2 comments
Open

Add HUB_COMPONENT_DIR implicit variable for deployment hooks #23

akranga opened this issue Jan 19, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed usability Related to CLI usability

Comments

@akranga
Copy link
Contributor

akranga commented Jan 19, 2023

Today we do restrict location where deployment hooks can be found. User will want to interact with artefacts inside component directory. To do so, hubctl should deliver environment variables

  • HUB_COMPONENT_DIR - absolute path to component directory
  • HUB_BASE_DIR - absolute path to hubfile

This will allow user to write something like pre-deployment hook like

cat << EOF > "$HUB_COMPONENT_DIR/values-generated.yaml"
serviceAccount:
  create: true
  name: "$HUB_COMPONENT"
  automountServiceAccountToken: true
  annotations:
    iam.gke.io/gcp-service-account: "$USER_GSA"
nodeSelector:
  iam.gke.io/gke-metadata-server-enabled: "true"
  kubernetes.io/os: "linux"
EOF

That will seed some additional configuration for helm

@akranga akranga added enhancement New feature or request usability Related to CLI usability labels Jan 19, 2023
@akranga akranga self-assigned this Jan 19, 2023
@akranga
Copy link
Contributor Author

akranga commented Jul 25, 2023

Also related to #35 . Proposing a breaking change to use HUB_COMPONENT_DIR as a CWD for hook. Rationale:

  • User creates a hook to operate inside component
  • If user should source resource inside context of a stack, they should use HUB_BASE_DIR
  • If user wants to know hook directory dirname "$0" should do the trick

@akranga
Copy link
Contributor Author

akranga commented Jul 26, 2023

Also adding extensions to the lookup. This will allow execution of hooks like aws/configure on a stack hook level. So the current script lookup logic is the following:

Resolve script name as:

  • find by exact filename
  • find by fuzzy logic in probeScriptthat checks for additional prefixes/suffixes such asbin/or.shand_`

Search in directories:

  • Component directory
  • CWD .
  • ./.hub
  • ./bin/
  • Extensions directory
  • System PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed usability Related to CLI usability
Projects
None yet
Development

No branches or pull requests

1 participant