Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Error while pushing with container_push #1413

Closed
sgammon opened this issue Feb 5, 2020 · 1 comment
Closed

Error while pushing with container_push #1413

sgammon opened this issue Feb 5, 2020 · 1 comment

Comments

@sgammon
Copy link

sgammon commented Feb 5, 2020

Hello rules_docker peeps,

I'm building a java_image target, with no sources (but runtime_deps and a main_class), and I am having some issues pushing it with container_push.

Here is the rough layout of my BUILD file:

java_image(
  name = "app-image",
  runtime_deps = [...],
  jvm_flags = [...],
  resources = [...],
)

container_push(
  name = "app-image-push",
  image = ":app-image",
  tag = "{BUILD_SCM_VERSION}",
  format = "OCI",
  repository = "$(project)/apps/test",
  registry = "us.gcr.io",
)

I then run this with the following command line:
echo "2.0.0" > .bazelversion && bazelisk run -s //:app-image-push

The above fails, with the following two errors:

  1. flag provided but not defined: -node_options
  2. see below:
Usage of /private/var/tmp/.../bin/.../app-image-push.runfiles/app/../io_bazel_rules_docker/container/go/cmd/pusher/darwin_amd64_stripped/pusher:
  -client-config-dir string
    	The path to the directory where the client configuration files are located. Overiddes the value from DOCKER_CONFIG.
  -config string
    	Path to the image config.json. Required when --format is Docker.
  -dst string
    	The destination location including repo and digest/tag of the docker image to push. Supports fully-qualified tag or digest references.
  -format string
    	The format of the uploaded image (Docker or OCI).
  -layer value
    	One or more layers with the following comma separated values (Compressed layer tarball, Uncompressed layer tarball, digest file, diff ID file). e.g., --layer layer.tar.gz,layer.tar,<file with digest>,<file with diffID>.
  -manifest string
    	Path to the manifest of the base image. This should be the very first image in the chain of images and is only really required for windows images with a base image that has foreign layers.
  -skip-unchanged-digest
    	If set to true, will only push images where the digest has changed.
  -stamp-info-file value
    	The list of paths to the stamp info files used to substitute supported attribute when a python format placeholder is provivided in dst, e.g., {BUILD_USER}.
  -tarball string
    	Path to the image tarball as generated by docker save.

This would imply the arguments provided to pusher aren't correct? Which appear as below:

set -eu

function guess_runfiles() {
    if [ -d ${BASH_SOURCE[0]}.runfiles ]; then
        # Runfiles are adjacent to the current script.
        echo "$( cd ${BASH_SOURCE[0]}.runfiles && pwd )"
    else
        # The current script is within some other script's runfiles.
        mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
        echo $mydir | sed -e 's|\(.*\.runfiles\)/.*|\1|'
    fi
}

RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"

${RUNFILES}/app/../io_bazel_rules_docker/container/go/cmd/pusher/darwin_amd64_stripped/pusher -stamp-info-file ${RUNFILES}/app/stable-status.txt -stamp-info-file ${RUNFILES}/app/volatile-status.txt --config=${RUNFILES}/app/app-image.0.config --layer=${RUNFILES}/app/../java_debug_image_base/image/000.tar.gz,${RUNFILES}/app/../java_debug_image_base/image/000.tar.gz.nogz,${RUNFILES}/app/../java_debug_image_base/image/000.tar.gz.sha256,${RUNFILES}/app/../java_debug_image_base/image/000.tar.gz.nogz.sha256 --layer=${RUNFILES}/app/../java_debug_image_base/image/001.tar.gz,${RUNFILES}/app/../java_debug_image_base/image/001.tar.gz.nogz,${RUNFILES}/app/../java_debug_image_base/image/001.tar.gz.sha256,${RUNFILES}/app/../java_debug_image_base/image/001.tar.gz.nogz.sha256 --layer=${RUNFILES}/app/../java_debug_image_base/image/002.tar.gz,${RUNFILES}/app/../java_debug_image_base/image/002.tar.gz.nogz,${RUNFILES}/app/../java_debug_image_base/image/002.tar.gz.sha256,${RUNFILES}/app/../java_debug_image_base/image/002.tar.gz.nogz.sha256 --layer=${RUNFILES}/app/../java_debug_image_base/image/003.tar.gz,${RUNFILES}/app/../java_debug_image_base/image/003.tar.gz.nogz,${RUNFILES}/app/../java_debug_image_base/image/003.tar.gz.sha256,${RUNFILES}/app/../java_debug_image_base/image/003.tar.gz.nogz.sha256 --layer=${RUNFILES}/app/../java_debug_image_base/image/004.tar.gz,${RUNFILES}/app/../java_debug_image_base/image/004.tar.gz.nogz,${RUNFILES}/app/../java_debug_image_base/image/004.tar.gz.sha256,${RUNFILES}/app/../java_debug_image_base/image/004.tar.gz.nogz.sha256 --layer=${RUNFILES}/app/app-image-layer.tar.gz,${RUNFILES}/app/app-image-layer.tar,${RUNFILES}/app/app-image-layer.tar.gz.sha256,${RUNFILES}/app/app-image-layer.tar.sha256 --manifest=${RUNFILES}/app/app-image.0.manifest --format=Docker --dst=us.gcr.io/(gcp project ID correctly placed here)/apps/test:{BUILD_SCM_VERSION} "$@"

I've tried removing BUILD_SCM_VERSION which is provided by my workspace status command, but that doesn't change anything. I've also tried OCI and Docker as formats.

I can't actually seem to find where -node_options is passed, and to what, because it isn't pusher, but it's involved somewhere/somehow.

Could someone help me get this working?

EDIT: adding srcs doesn't seem to help, either.

sgammon added a commit to sgammon/elide-archive that referenced this issue Feb 5, 2020
- Add Java container target
- Add example push command (currently blocked on
  bazelbuild/rules_docker#1413)
@sgammon
Copy link
Author

sgammon commented Feb 6, 2020

Nevermind, the -node_options flag was coming from suggested options for rules_nodejs.

@sgammon sgammon closed this as completed Feb 6, 2020
sgammon added a commit to sgammon/elide-archive that referenced this issue Feb 6, 2020
* Feature: Packaging

This changeset introduces initial packaging for Gust, and for apps
that use Gust. Changes so far:

- [x] Fixup package for eventual publish to `npm`
- [x] Add support for GitHub packages
- [x] Add support for `rules_docker` targets
- [x] Add support for tarball targets

* Update Micronaut -> 1.3.0

* Upgrade Yarn dependencies

* Upgrade Bazel dependencies

* Fixes and functionality for crosslib builds

- Fix defs when used in a cross-lib context
- Fix DOM test
- Tighten up DualStackTest

* Initial support for container targets

- Add Java container target
- Add example push command (currently blocked on
  bazelbuild/rules_docker#1413)

* Re-enable container tag via BUILD_SCM_VERSION

* Fix workspace status command file

* Working container build-and-run flow

- Ability to build Java app containers, and push them to GCR
- Tested containers locally (manually for now)

* Update fork of rules_closure

* Remove forced JDK8 build flags

* Update J2CL with static bootclasspath

* Update rules_graal with new attrs for debugging

* Initial build flow for Graal native binary targets

- Setup build lib
- Attach to Graal image
- Override default compiler path (workaround for Bazel bug)

* Re-enable disk caching in CI

* Native binary support, with container image

- Support building via `native-image`
- Support pushing to container repo for native image
- No cross-platform build support yet (oracle/graal#407)

* Fix injected testdeps

* Don't enable native targets without a flag

* Add CI routine for baking samples

* Cleaner CI flow

* Attempt GCR auth fix, flush keys

* Another credentials fix

* Fix Bazel label in regular CI job

* Try auth via gcloud

* Explicitly activate gcloud key

* Apply new auth to sample image build

* Fixup key paths in CI

* Move GCP install step up in CI flow

* Cleanup CI configs

* Use relative access to service key from env

* Unify image bake, restore Docker index pull

* Add base container build file

* Use new base container
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant