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 Examples (was: filename in release) #57

Open
TJM opened this issue Apr 11, 2023 · 7 comments
Open

Add Examples (was: filename in release) #57

TJM opened this issue Apr 11, 2023 · 7 comments

Comments

@TJM
Copy link
Contributor

TJM commented Apr 11, 2023

... as per the changelog in v0.2.12:

IMPROVEMENTS:

- Plugin now reports its version to Vault server. You can see it with `vault plugin list` command.
- Remove version number from the binary file name (now `artifactory-secrets-plugin`, vs `artifactory-secrets-plugin_v0.2.6`) now that it registers as 'versioned' plugin with Vault server.
- Update README on how to register plugin to reflect this change of binary name.
- Update Makefile to use GoRelease (same as GitHub Action) to build binary for development process.

The problem is that when upgrading the plugin on a cluster, you will need both binaries on the system at the same time, so you will need to rename it to have the version in the name or do something funky like _new or _old ??

I can handle this in my packer script, but it was easier to just have the name be the version.

Or.. maybe I am doing something wrong? :)

something like:

#!/bin/bash -e
## LOTS OF OTHER STUFF
  ## Artifactory Secrets Plugin - keep the name artifactory-secrets-plugin_v(VERSION), to allow safe upgrades
  ARTIFACTORY_PLUGIN_VERSIONS="0.2.11 0.2.12"
  for ver in ${ARTIFACTORY_PLUGIN_VERSIONS}; do
    curl -sSOL "https://github.com/jfrog/artifactory-secrets-plugin/releases/download/v${ver}/artifactory-secrets-plugin_${ver}_linux_amd64.zip"
    curl -sSL "https://github.com/jfrog/artifactory-secrets-plugin/releases/download/v${ver}/artifactory-secrets-plugin_${ver}_checksums.txt"|grep linux_amd64  > artifactory-secrets-plugin-checksums.txt
    sha256sum -c artifactory-secrets-plugin-checksums.txt
    unzip -jo "artifactory-secrets-plugin_${ver}_linux_amd64.zip" "artifactory-secrets-plugin*"
    if test -f "artifactory-secrets-plugin_v${ver}"; then
      sudo mv "artifactory-secrets-plugin_v${ver}" "${VAULT_PLUGINS_DIR}/artifactory-secrets-plugin_v${ver}" # Keep versioned binary
    else
      sudo mv artifactory-secrets-plugin "${VAULT_PLUGINS_DIR}/artifactory-secrets-plugin_v${ver}" # make the binary versioned
    fi
    sudo chown root:root "${VAULT_PLUGINS_DIR}/artifactory-secrets-plugin_v${ver}"
    sudo chmod 755 "${VAULT_PLUGINS_DIR}/artifactory-secrets-plugin_v${ver}"
  done
@alexhung
Copy link
Member

The way I understand (and assume) is that when Vault server mount/enable a plugin, it starts a new process(?) thus keeping it in memory. I can be wrong though. Overwriting the binary with new version won't affect existing mounted plugin. And to distinguish between old and new during registration, the option -version would be used.

(Of course one should make a backup copy (if not already) of the existing binary before copying in the new version.)

I'm open to revert back to including version in file name if it makes life easier. The reason for the switch is to follow common convention where binary name does not include version.

@alexhung alexhung self-assigned this Apr 11, 2023
@TJM
Copy link
Contributor Author

TJM commented Apr 11, 2023

I am not saying to change for me. Perhaps my vault cluster in a Google MIG is overly complex. I actually think the upgrade instructions say to backup the old binary, but maybe that was to be able to move back to the previous version. I think it said to not overwrite the binary, but it seems like it could stop/start that process at any time, so I had planned to keep the full name.

DOC: https://developer.hashicorp.com/vault/docs/upgrading/plugins

the plugin binary in this example has the version on it tho :-/

@alexhung
Copy link
Member

True. When I examine a few plugins in the both official and partner plugins, all of the binaries do not contain the version string.

@TJM
Copy link
Contributor Author

TJM commented Apr 21, 2023

I guess I will use my script above to keep the version string... I wonder if something like that would be useful? It is part of our packer scripts to build a vault image.

@alexhung
Copy link
Member

Feel free to open a PR to add your script to the project (in ./scripts directory?).

@TJM
Copy link
Contributor Author

TJM commented Apr 24, 2023

Interesting idea... it could for sure be in scripts or maybe "examples" or something? I could actually include more stuff (Terraform)

@alexhung
Copy link
Member

'examples' is better fit, along with references to them in README

@TJM TJM changed the title filename in release Add Examples (was: filename in release) Apr 24, 2023
@alexhung alexhung removed their assignment May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants