Brand token env var
This commit is contained in:
parent
ee1ecbd217
commit
073d94e288
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from decouple import config
|
from decouple import config
|
||||||
import subprocess
|
|
||||||
import click
|
import click
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from python_on_whales import docker
|
from python_on_whales import docker
|
||||||
@ -56,20 +55,12 @@ def command(ctx, include, exclude):
|
|||||||
if verbose:
|
if verbose:
|
||||||
print(f'Packages: {packages}')
|
print(f'Packages: {packages}')
|
||||||
|
|
||||||
# To build a package we need to run the cerc/build-js container with a bind mount from the project directory
|
|
||||||
# and use docker run to execute the build script inside that container
|
|
||||||
# docker.run("cerc/builder-js", ["ls", "/host"], volumes=[("<project-dir-here>", "/workspace")])
|
|
||||||
# sh -c 'cd /workspace && NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6 \
|
|
||||||
# build-npm-package.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 1.0.0-beta.1'
|
|
||||||
# NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6
|
|
||||||
# Set uid/gid
|
|
||||||
|
|
||||||
def build_package(package):
|
def build_package(package):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(f"Building: {package}")
|
print(f"Building: {package}")
|
||||||
repo_dir = package
|
repo_dir = package
|
||||||
repo_full_path = os.path.join(dev_root_path, repo_dir)
|
repo_full_path = os.path.join(dev_root_path, repo_dir)
|
||||||
build_command = ["sh", "-c", "'cd /workspace && build-npm-package.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 1.0.0-beta.1'"]
|
build_command = ["sh", "-c", "cd /workspace && build-npm-package.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 1.0.15"]
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Executing: {build_command}")
|
print(f"Executing: {build_command}")
|
||||||
@ -77,9 +68,12 @@ def command(ctx, include, exclude):
|
|||||||
remove=True,
|
remove=True,
|
||||||
interactive=True,
|
interactive=True,
|
||||||
tty=True,
|
tty=True,
|
||||||
envs={"NPM_AUTH_TOKEN": "6613572a28ebebaee20ccd90064251fa8c2b94f6"},
|
user=f"{os.getuid()}:{os.getgid()}",
|
||||||
|
envs={"CERC_NPM_AUTH_TOKEN": os.environ["CERC_NPM_AUTH_TOKEN"]},
|
||||||
add_hosts=[("host.docker.internal", "host-gateway")],
|
add_hosts=[("host.docker.internal", "host-gateway")],
|
||||||
volumes=[(repo_full_path, "/workspace")])
|
volumes=[(repo_full_path, "/workspace")],
|
||||||
|
command=build_command
|
||||||
|
)
|
||||||
# TODO: check result in build_result.returncode
|
# TODO: check result in build_result.returncode
|
||||||
print(f"Result is: {build_result}")
|
print(f"Result is: {build_result}")
|
||||||
else:
|
else:
|
||||||
|
@ -1 +1,4 @@
|
|||||||
gem
|
gem
|
||||||
|
laconic-sdk
|
||||||
|
debug
|
||||||
|
laconic-registry-cli
|
||||||
|
@ -12,6 +12,6 @@ it is possible to build packages manually by invoking `docker run` , for example
|
|||||||
```
|
```
|
||||||
$ docker run --rm -it --add-host host.docker.internal:host-gateway \
|
$ docker run --rm -it --add-host host.docker.internal:host-gateway \
|
||||||
-v ${HOME}/cerc/laconic-registry-cli:/workspace cerc/builder-js \
|
-v ${HOME}/cerc/laconic-registry-cli:/workspace cerc/builder-js \
|
||||||
sh -c 'cd /workspace && NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6 \
|
sh -c 'cd /workspace && CERC_NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6 \
|
||||||
build-npm-package-local-dependencies.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 0.1.8'
|
build-npm-package-local-dependencies.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 0.1.8'
|
||||||
```
|
```
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Usage: build-npm-package.sh <registry-url> <publish-with-this-version>
|
# Usage: build-npm-package.sh <registry-url> <publish-with-this-version>
|
||||||
# Note: supply the registry auth token in NPM_AUTH_TOKEN
|
# Note: supply the registry auth token in CERC_NPM_AUTH_TOKEN
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
@ -8,15 +8,15 @@ if [[ $# -ne 2 ]]; then
|
|||||||
echo "Illegal number of parameters" >&2
|
echo "Illegal number of parameters" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ -z "${NPM_AUTH_TOKEN}" ]]; then
|
if [[ -z "${CERC_NPM_AUTH_TOKEN}" ]]; then
|
||||||
echo "NPM_AUTH_TOKEN is not set" >&2
|
echo "CERC_NPM_AUTH_TOKEN is not set" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
local_npm_registry_url=$1
|
local_npm_registry_url=$1
|
||||||
package_publish_version=$2
|
package_publish_version=$2
|
||||||
npm config set @lirewine:registry ${local_npm_registry_url}
|
npm config set @lirewine:registry ${local_npm_registry_url}
|
||||||
npm config set @cerc-io:registry ${local_npm_registry_url}
|
npm config set @cerc-io:registry ${local_npm_registry_url}
|
||||||
npm config set -- ${local_npm_registry_url}:_authToken ${NPM_AUTH_TOKEN}
|
npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||||
echo "Build and publish version ${package_publish_version}"
|
echo "Build and publish version ${package_publish_version}"
|
||||||
yarn install
|
yarn install
|
||||||
yarn build
|
yarn build
|
||||||
|
Loading…
Reference in New Issue
Block a user