jakeswenson / BitBetter

Modify bit warden to provide my own licensing for self hosting
500 stars 112 forks source link

ERROR: yaml.scanner.ScannerError: mapping values are not allowed here (new issue) #134

Closed Grommish closed 2 years ago

Grommish commented 2 years ago

Similar to https://github.com/jakeswenson/BitBetter/pull/129

BW_VERSION="$(curl --silent https://raw.githubusercontent.com/bitwarden/self-host/master/bitwarden.sh | grep 'COREVERSION="' | sed 's/^[^"]*"//; s/".*//')" returns an empty string.

The https://raw.githubusercontent.com/bitwarden/self-host/master/bitwarden.sh script, BW_VERSION in bitwarden.sh calls curl -sL https://go.btwrdn.co/bw-sh-versions | grep '^ *"'${1}'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//' which returns empty, as bitwarden.sh now uses COREVERSION=$(getVersion coreVersion)

https://github.com/bitwarden/self-host/blob/master/bitwarden.sh#L49

SCRIPTS_DIR="$OUTPUT/scripts"
BITWARDEN_SCRIPT_URL="https://go.btwrdn.co/bw-sh"
RUN_SCRIPT_URL="https://go.btwrdn.co/bw-sh-run"
VERSION_ENDPOINT="https://go.btwrdn.co/bw-sh-versions"

# Please do not create pull requests modifying the version numbers.
function getVersion() {
    echo $(curl -sL $VERSION_ENDPOINT | grep  '^ *"'${1}'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
}

https://go.btwrdn.co/bw-sh-versions redirects to https://raw.githubusercontent.com/bitwarden/self-host/master/version.json

which currently returns:

{
  "versions": {
      "coreVersion":"1.47.1",
      "webVersion":"2.27.0",
      "keyConnectorVersion":"1.0.1"
  }
}

returns an empty string, which means no version number is populated and causes the ScannerError as bitwarden/bwdata/docker/docker-compose.override.yml shows

version: '3'

services:
  api:
    image: bitbetter/api:

  identity:
    image: bitbetter/identity:
Grommish commented 2 years ago

Reusing the code in bitwarden.sh provides the correct coreVersion, and produces the followng

version: '3'

services:
  api:
    image: bitbetter/api:1.47.1

  identity:
    image: bitbetter/identity:1.47.1
VERSION_ENDPOINT="https://go.btwrdn.co/bw-sh-versions"

# Please do not create pull requests modifying the version numbers.
function getVersion() {
    echo $(curl -sL $VERSION_ENDPOINT | grep  '^ *"'${1}'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
}

BW_VERSION=$(getVersion coreVersion)

But I still am getting errors

ERROR: for identity  pull access denied for bitbetter/identity, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

ERROR: for api  pull access denied for bitbetter/api, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
ERROR: pull access denied for bitbetter/api, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Ayitaka commented 2 years ago

BW_VERSION=$(curl -sL https://go.btwrdn.co/bw-sh-versions | grep '^ *"'coreVersion'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')

(Edit) Requires changes to: https://github.com/jakeswenson/BitBetter/blob/master/build.sh https://github.com/jakeswenson/BitBetter/blob/master/update-bitwarden.sh