Git Product home page Git Product logo

boilerplate's Introduction

boilerplate

Standard development infrastructure and tooling to be used across repositories in an organization.

This work was inspired by, and partially cribbed from, lyft/boilerplate.

Quick Start

Bootstrap and subscribe to openshift/golang-osd-operator by pasting the following scriptlet into your terminal. Your pwd should be a clean checkout of the repository you wish to onboard.

curl --output boilerplate/update --create-dirs https://raw.githubusercontent.com/openshift/boilerplate/master/boilerplate/update
chmod +x boilerplate/update
echo "openshift/golang-osd-operator" > boilerplate/update.cfg
printf "\n.PHONY: boilerplate-update\nboilerplate-update:\n\t@boilerplate/update\n" >> Makefile
make boilerplate-update
sed -i '1s,^,include boilerplate/generated-includes.mk\n\n,' Makefile
make boilerplate-commit

Pay attention to the output! It contains critical instructions!

Overview

The principle behind this is to copy the standardized artifacts from this repository into the consuming repository. This is as opposed to pulling them dynamically on each use. In other words, consumers update on demand. It might seem like a disadvantage for consumers to be allowed to get out of sync, but (as long as a system is in place to check/update frequently) it allows more careful and explicit curation of changes. The multiplication of storage space is assumed to be insignificant. (Don't use this for huge binary blobs. If you need to boilerplate a compiled binary or similar, consider storing the source here and compiling it at the target via your update.)

For more discussion of the motivation behind copying rather than using remote sources on the fly, see lyft's README.

A Pretty Picture

The lifecycle from the consuming repository's perspective:

              XXXXXXXXXXXXX                           XXXXXXXXXX
              X Bootstrap X                           X Update X
              XXXXXXXXXXXXX                           XXXXXXXXXX

             +-------------+                    +---------------------+
             |Download     |                    |Subscribe (optional):|
             |update script|                    |Edit update.cfg      |
             +-----+-------+                    +----------+----------+
                   |                                       |
                   v                                       v
          +--------+---------+                 +-----------+-----------+
          |Create            |                 |make boilerplate-update|
          |boilerplate-update|                 +-----------+-----------+
          |make target       |                             |
          +--------+---------+                             v
                   |                           +-----------+-----------+
                   v                           |Commit (automated):    |
              +----+-----+                     |make boilerplate-commit|
              |Touch     |                     +-----------+-----------+
              |update.cfg|                                 |
              +----+-----+                                 v
                   |                              +--------+--------+
                   v                              |Validate changes,|
        +----------+------------+                 |make local edits |
        |make boilerplate-update|                 +--------+--------+
        +----------+------------+                          |
                   |                                       v
                   v                               +-------+-------+
+------------------+----------------------+        |Commit (manual)|
|include boilerplate/generated-includes.mk|        +-------+-------+
+------------------+----------------------+                |
                   |                                       v
                   v                                     +-+--+
        +----------+------------+                        |push|
        |Commit (automated):    |                        +----+
        |make boilerplate-commit|
        +----------+------------+
                   |
                   v
                 +-+--+
                 |push|
                 +----+

Consumer Philosophy

Consuming repositories should think about boilerplate deltas the same way you would think about the vendor/ directory for go dependencies: trust and ignore.

Trust

When reviewing a PR that includes a boilerplate changes, you can trust:

  • That they have already been peer reviewed in the boilerplate repository itself. You may of course wish to review them at a high level to understand how they relate to your specific repository.
  • That they are unchanged from their original form in the boilerplate repository itself. Assuming you are using standardized prow jobs, freeze-check is wired in to make sure of this.

Ignore

As with deltas under vendor/, changes under boilerplate/ can be ignored the vast majority of the time. To facilitate this, you may wish to take advantage of linguist, which is used by GitHub, to hide deltas under boilerplate/ by default. This will make them appear the same as generated mocks, go.sum, etc.: unrendered by default, but with a link to render them on demand. To enable this behavior, add the following to the top of the .gitattributes file in the root of your repository:

# Hide most boilerplate deltas by default
boilerplate/** linguist-generated=true

Note that, for security reasons, boilerplate will generate a block of overrides to force by-default rendering of certain files under boilerplate/, as well as the .gitattributes file itself. This is so that malicious changes attempting to subvert the tooling behind the trust model will always be rendered.

Mechanism

A "convention" lives in a subdirectory hierarchy of boilerplate and is identified by the subdirectory's path. For example, a convention around OSD operators written in Go lives under boilerplate/openshift/golang-osd-operator and is identified as openshift/golang-osd-operator.

A convention comprises:

  • Files, which are copied verbatim into the consuming repository at update time, replacing whatever was there before. The source directory structure is mirrored in the consuming repository -- e.g. boilerplate/boilerplate/openshift/golang-osd-operator/* is copied into ${TARGET_REPO}/boilerplate/golang-osd-operator/*.
  • An update script (which can be any kind of executable, but please keep portability in mind). If present, this script is invoked twice during an update:
    • Once before files are copied, with the command line argument PRE. This can be used to prepare for the copy and/or validate that it is allowed to happen. If the program exits nonzero, the update is aborted.
    • Once after files are copied, with the command line argument POST. This can be used to perform any configuration required after files are laid down. For example, some files may need to be copied to other locations, or templated values therein substituted based on the environment of the consumer. If the script exits nonzero, the update is aborted (subsequent conventions are not applied).

Consuming

Bootstrap

  1. Copy the main update script into your repo as boilerplate/update. Make sure it is executable (chmod +x).

Note: It is important that the update script be at the expected path, because one of the things it does is update itself!

  1. Touch (create empty) the configuration file boilerplate/update.cfg. This will be use later.

  2. Create a Makefile target as follows:

.PHONY: boilerplate-update
boilerplate-update:
	@boilerplate/update

Note: It is important that the Makefile target have the expected name, because (eventually) there may be automated jobs that use it to look for available updates.

  1. Run your first update.
$ make boilerplate-update
  1. Include the "nexus" makefile. This file is generated by boilerplate and will import make rules for any conventions you subscribe to, as well as for the boilerplate framework itself. Add the following line to your Makefile, preferably at the top:
include boilerplate/generated-includes.mk
  1. Commit. For convenience, you can use the boilerplate-commit target provided by boilerplate:
$ make boilerplate-commit

The above steps can be performed by pasting the following scriptlet into your console:

curl --output boilerplate/update --create-dirs https://raw.githubusercontent.com/openshift/boilerplate/master/boilerplate/update
chmod +x boilerplate/update
touch boilerplate/update.cfg
printf "\n.PHONY: boilerplate-update\nboilerplate-update:\n\t@boilerplate/update\n" >> Makefile
make boilerplate-update
sed -i '1s,^,include boilerplate/generated-includes.mk\n\n,' Makefile
make boilerplate-commit
  1. boilerplate-commit creates a commit in a new topic branch. Push it to your origin remote as usual to create a pull request.

Configure

The update program looks for a configuration file at boilerplate/update.cfg. It contains a list of conventions, which are simply the names of subdirectory paths under boilerplate, one per line. Whitespace and #-style comments are allowed. For example, to adopt the openshift/golang-osd-operator convention, your boilerplate/update.cfg may look like:

# Use standards for Go-based OSD operators
openshift/golang-osd-operator

Opt into updates of a convention by including it in the file; otherwise you are opted out, even if you had previously used a given convention.

Note: If you opt out of a previously-used convention by removing it from your config, you are responsible for cleaning up; the main update driver doesn't do it for you.

Note: Updates are applied in the order in which they are listed in the configuration. If conventions need to be applied in a certain order (which should be avoided if at all possible), it should be called out in their respective READMEs.

Follow any configuration changes with the "Update" sequence described below:

Register

To take advantage of certain automations, your consuming repository must be registered as a subscriber. See the documentation for details on how this works.

Update

Use this procedure to pick up newly-subscribed conventions; and run it periodically to pick up changes to existing subscriptions or to the boilerplate framework itself.

  1. Run make boilerplate-update on a clean branch in your consuming repository.

  2. Commit the changes. For convenience, you can use make boilerplate-commit to automatically create a new topic branch and commit any changes resulting from the update.

  3. Sanity check the changes against your specific repository, fixing any breakages and making local changes appropriate to the substance of the update. If you used make boilerplate-commit, you can use git show to see a summary of what was changed. NOTE: You must not touch files owned by boilerplate. Any changes to boilerplate content must be made in the boilerplate repo itself.

  4. If local changes were necessary, commit them manually. You should commit to the topic branch you (or make boilerplate-commit) created above so that your PR is internally consistent and will build. You may choose to keep the two commits separate (preferred), or combine them.

  5. Push the branch to create a PR as usual.

To update multiple consumers at once, use subscriber propose update -- see the documentation for details.

Multiple Updates

You may create an update PR and, before it merges, want or need to include commits that subsequently merged into boilerplate. (A common cause is a fix required in boilerplate to make your consumer's CI pass.) In this case, in order to make sure the PR description is correct, it is recommended to close the original PR and create a new one from your default branch. If you had additional commits in play, these can often simply be rebased onto the new branch.

Contributing

In your fork of this repository (not a consuming repository):

  • Create a subdirectory structure under boilerplate. The path of the directory is the name of your convention. Do not prefix your convention name with an underscore; such subdirectories are reserved for use by the infrastructure. In your leaf directory:
  • Add a README.md describing what your convention does and how it works.
  • Add any files that need to be copied into consuming repositories. (Optional -- you might have a convention that only needs to run update.)
  • Create an executable called update. (Optional -- you might have a convention that only needs to lay down files.)
    • It must accept exactly one command line argument, which will be either PRE or POST. The main driver will invoke update PRE before copying files, and update POST after copying files. (You may wish to ignore a phase, e.g. via [[ "$1" == "PRE" ]] && exit 0.)
      • Note: We always run the new version of the update script.
      • Note: The entire convention directory is wiped out and replaced between PRE and POST, so e.g. don't try to store any information there.
    • It must indicate success or failure by exiting with zero or nonzero status, respectively. Failure will cause the main driver to abort.
    • The main driver exports the following variables for use by updates:
      • REPO_ROOT: The fully-qualified path to the root directory of the repository in which we are running.
      • REPO_NAME: The short name (so like boilerplate, not openshift/boilerplate) of the git repository in which we are running. (Note that discovering this relies on the origin remote being configured properly.)
      • CONVENTION_ROOT: The path to the directory containing the main update driver and the convention subdirectories themselves. Of note, ${CONVENTION_ROOT}/_lib/ contains some utilities that may be useful for updates.
      • LATEST_IMAGE_TAG: The tag for the most recent build image produced by boilerplate.

Environment setup

To test your changes, you can use the BOILERPLATE_GIT_REPO environment variable and set it to your local clone in order to override the version of boilerplate used (Example: export BOILERPLATE_GIT_REPO=~/git/boilerplate).

Default update behaviour consists of cloning the git repo, so ensure you have your changes locally committed for your testing. Alternatively, you can use the BOILERPLATE_GIT_CLONE variable to override the base command used for cloning the project. Example of usecases :

  • Add some flags to the git clone command
  • Replace git clone by a copy command such as rsync or cp in order to avoid having to regularly commit changes

Tests

Test cases are executed by running make test. This must be done on a clean git repository; otherwise the tests will not be using your uncommitted changes.

Add new test cases by creating executable files in the test/case subdirectory. These are discovered and executed in lexicographic order by make test. Your test case should exit zero to indicate success; nonzero to indicate failure. The test/lib.sh library defines convenient variables and functions you can use if your test case is written in bash. See existing test cases for examples.

Build Images

If you make a change to the build image produced by boilerplate -- i.e. by changing anything in config/ -- you must:

  1. Publish a new tag. This will be picked up by AppSRE and used to publish a new tagged image for consumption via LATEST_IMAGE_TAG in conventions. The tag must be named image-v{X}.{Y}.{Z}, using semver principles when deciding what {X}.{Y}.{Z} should be. See #180 for an example.

    git tag image-v1.2.3
    git push origin --tags
    # Create PR here
    # Typically only team leads can push tags to upstream, so they will need to continue by
    # checking out your fork and then running
    git push upstream --tags

    NOTE: You must do the upstream push after creating your PR. Otherwise, the tagged commit will not exist upstream.

  2. Import that tag via boilerplate's ImageStream in openshift/release by adding an element to the supplementalCIImages list in this configuration file.

Making CI Efficient

The backing image is built in prow with every commit, even when nothing about it has changed. To make this faster, we periodically ratchet the base image (the FROM in the Dockerfile) to point to the previously-released image, and clear out the build script to start from that point. However, in app-sre we build from scratch (exactly once per image-v* tag!), via a separate Dockerfile. Thus, there is a (very small) chance that these builds will behave differently.

When the underlying base image changes significantly, the FROM directive in config/Dockerfile may be temporarily changed to the new upstream image. However, as soon as it is stable, a new commit should be made to increment the version so that the FROM directive is the base image created in step 2. This speeds up CI for ourselves and consumers.

For example, let's say that the current base image has Go 1.18, but we need Go 1.19, and it's not available in boilerplate:image-v2.Y.Z

  1. Update config/Dockerfile and config/Dockerfile.appsre
    FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.19-openshift-4.12
    
  2. Then, update the rest of boilerplate accordingly, push a new tag, and mirror the image into openshift/release to create boilerplate:image-v3.0.0
  3. Finally, update config/Dockerfile's FROM directive to speed up CI and tag a new version for image-v3.0.1
    FROM registry.ci.openshift.org/openshift/boilerplate:image-v3.0.0
    

Picking Up (Security) Fixes

We only build and publish a new build image on commits tagged with image-v*, which we force you to do whenever something about boilerplate's image configuration changes. If the base image (golang-*) is updated for any reason, including security fixes, the boilerplate build image will only pick up those changes the next time we produce a new version. To pick up such changes right away, simply produce a new version (identical to the previous in terms of what boilerplate configures) according to the instructions above. Of course, consumers will need to update to/past the tagged commit in order to use the new image.

boilerplate's People

Contributors

2uasimojo avatar ajpantuso avatar alexvulaj avatar arjunrn avatar bdematte avatar bergmannf avatar bng0y avatar cblecker avatar clcollins avatar dofinn avatar dustman9000 avatar georgettica avatar iamkirkbater avatar jbpratt avatar jharrington22 avatar karthikperu7 avatar mjlshen avatar mrbarge avatar mrsantamaria avatar openshift-ci[bot] avatar openshift-merge-bot[bot] avatar openshift-merge-robot avatar ravitri avatar ritmun avatar rporres avatar sedroche avatar supreeth7 avatar tonytheleg avatar typeid avatar wanghaoran1988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boilerplate's Issues

Running boilerplate:image-v1.0.0 with --userns keep-id first time takes 70min and increases image size +4g

When trying to start boilerplate container for the first time on a new f34 vm and --userns keep-id is passed:

container_id=$($CONTAINER_ENGINE run --userns keep-id -d -v "$REPO_ROOT":"$CONTAINER_MOUNT":Z $IMAGE_PULL_PATH sleep infinity)

Podman takes 70min to run and boilerplate image increases by 4gb. When --userns keep-id is not used, container starts within seconds. Is this expected behaviour?

Here's the debug log:

podman versions


Begin time     : Fri 25 Jun 2021 09:35:10 AM UTC
Begin rpmdb    : 956:4b115748d13b47de1955c90c04da11e6841e983c
End time       : Fri 25 Jun 2021 09:36:40 AM UTC (90 seconds)
End rpmdb      : 976:e5c3e45bfe5a3b6ea17db447438af273c3c5e541
User           :  <tomas>
Return-Code    : Success
Releasever     : 34
Command Line   : 
Comment        : 
Packages Altered:
    Install buildah-1.21.0-1.fc34.x86_64                          @os
    Install catatonit-0.1.5-4.fc34.x86_64                         @os
    Install conmon-2:2.0.27-2.fc34.x86_64                         @os
    Install container-selinux-2:2.163.0-1.fc34.noarch             @os
    Install containernetworking-plugins-1.0.0-0.2.rc1.fc34.x86_64 @os
    Install containers-common-4:1-19.fc34.noarch                  @os
    Install criu-3.15-3.fc34.x86_64                               @os
    Install criu-libs-3.15-3.fc34.x86_64                          @os
    Install crun-0.20.1-1.fc34.x86_64                             @os
    Install dnsmasq-2.85-1.fc34.x86_64                            @os
    Install fuse-overlayfs-1.5.0-1.fc34.x86_64                    @os
    Install fuse3-3.10.4-1.fc34.x86_64                            @os
    Install libbsd-0.10.0-7.fc34.x86_64                           @os
    Install libnet-1.2-2.fc34.x86_64                              @os
    Install libslirp-4.4.0-2.fc34.x86_64                          @os
    Install podman-3:3.2.1-1.fc34.x86_64                          @os
    Install podman-compose-0.1.7-4.git20210129.fc34.noarch        @os
    Install podman-plugins-3:3.2.1-1.fc34.x86_64                  @os
    Install slirp4netns-1.1.9-1.fc34.x86_64                       @os
    Install yajl-2.1.0-16.fc34.x86_64                             @os


Pull image

[tomas@dev-vm managed-upgrade-operator]$ podman pull quay.io/app-sre/boilerplate:image-v1.0.0
Trying to pull quay.io/app-sre/boilerplate:image-v1.0.0...
Getting image source signatures
Copying blob 875a3c098773 done
Copying blob 7cf645468759 done
Copying blob d5e1781397c5 done
Copying blob 041d59463982 done
Copying config 4070d12a8d done
Writing manifest to image destination
Storing signatures
4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849

Show images

[tomas@dev-vm managed-upgrade-operator]$ podman images
REPOSITORY                   TAG           IMAGE ID      CREATED      SIZE
quay.io/app-sre/boilerplate  image-v1.0.0  4070d12a8d3f  5 weeks ago  2.65 GB

Run image without --userns keep-id

[tomas@dev-vm managed-upgrade-operator]$ time /usr/bin/podman run -d -v /storage/ram/tomas/Development/src/github/openshift/managed-upgrade-operator:/go/src/github.com/openshift/managed-upgrade-operator:Z quay.io/app-sre/boilerplate:image-v1.0.0 echo done
d749b687b2aee1d17ef2c646e2aca7275b3e17ee683869eab356a6a98bcb51a8

real    0m1.393s
user    0m0.161s
sys     0m0.122s
[tomas@dev-vm managed-upgrade-operator]$ podman rm $(podman ps -aq)
d749b687b2aee1d17ef2c646e2aca7275b3e17ee683869eab356a6a98bcb51a8

Set log level to debug and run container with --userns keep-id

[tomas@dev-vm managed-upgrade-operator]$ time /usr/bin/podman --log-level debug run --userns keep-id -d -v /storage/ram/tomas/Development/src/github/openshift/managed-upgrade-operator:/go/src/github.com/openshift/managed-upgrade-operator:Z quay.io/app-sre/boilerplate:image-v1.0.0 echo done
INFO[0000] /usr/bin/podman filtering at log level debug
DEBU[0000] Called run.PersistentPreRunE(/usr/bin/podman --log-level debug run --userns keep-id -d -v /storage/ram/tomas/Development/src/github/openshift/managed-upgrade-operator:/go/src/github.com/openshift/managed-upgrade-operator:Z quay.io/app-sre/boilerplate:image-v1.0.0 echo done)
DEBU[0000] cached value indicated that overlay is supported
DEBU[0000] Merged system config "/usr/share/containers/containers.conf"
DEBU[0000] cached value indicated that overlay is supported
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /home/tomas/.local/share/containers/storage/libpod/bolt_state.db
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /home/tomas/.local/share/containers/storage
DEBU[0000] Using run root /run/user/1000/containers
DEBU[0000] Using static dir /home/tomas/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /run/user/1000/libpod/tmp
DEBU[0000] Using volume path /home/tomas/.local/share/containers/storage/volumes
DEBU[0000] cached value indicated that overlay is supported
DEBU[0000] Set libpod namespace to ""
DEBU[0000] [graphdriver] trying provided driver "overlay"
DEBU[0000] cached value indicated that overlay is supported
DEBU[0000] cached value indicated that metacopy is not being used
DEBU[0000] cached value indicated that native-diff is not being used
INFO[0000] Not using native diff for overlay, this may cause degraded performance for building images: opaque flag erroneously copied up, consider update to kernel 4.8 or later to fix
DEBU[0000] backingFs=xfs, projectQuotaSupported=false, useNativeDiff=false, usingMetacopy=false
DEBU[0000] Initializing event backend journald
DEBU[0000] configured OCI runtime runc initialization failed: no valid executable found for OCI runtime runc: invalid argument
DEBU[0000] configured OCI runtime kata initialization failed: no valid executable found for OCI runtime kata: invalid argument
DEBU[0000] configured OCI runtime runsc initialization failed: no valid executable found for OCI runtime runsc: invalid argument
DEBU[0000] Using OCI runtime "/usr/bin/crun"  
DEBU[0000] Default CNI network name podman is unchangeable
INFO[0000] Setting parallel job count to 7
DEBU[0000] Looking up image "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] Trying "quay.io/app-sre/boilerplate:image-v1.0.0" ...
DEBU[0000] parsed reference into "[overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] Inspecting image 4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] User mount /storage/ram/tomas/Development/src/github/openshift/managed-upgrade-operator:/go/src/github.com/openshift/managed-upgrade-operator options [Z]
DEBU[0000] Looking up image "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] Trying "quay.io/app-sre/boilerplate:image-v1.0.0" ...
DEBU[0000] parsed reference into "[overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage ([overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849)
DEBU[0000] Inspecting image 4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Looking up image "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] Trying "quay.io/app-sre/boilerplate:image-v1.0.0" ...
DEBU[0000] parsed reference into "[overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage ([overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849)
DEBU[0000] Inspecting image 4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Looking up image "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] Trying "quay.io/app-sre/boilerplate:image-v1.0.0" ...
DEBU[0000] parsed reference into "[overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Found image "quay.io/app-sre/boilerplate:image-v1.0.0" as "quay.io/app-sre/boilerplate:image-v1.0.0" in local containers storage ([overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849)
DEBU[0000] Inspecting image 4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] Inspecting image 4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849
DEBU[0000] using systemd mode: false
DEBU[0000] No hostname set; container's hostname will default to runtime default
DEBU[0000] Loading seccomp profile from "/usr/share/containers/seccomp.json"
DEBU[0000] Adding mount /proc
DEBU[0000] Adding mount /dev
DEBU[0000] Adding mount /dev/pts
DEBU[0000] Adding mount /dev/mqueue
DEBU[0000] Adding mount /sys
DEBU[0000] Adding mount /sys/fs/cgroup
DEBU[0000] Allocated lock 0 for container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4
DEBU[0000] parsed reference into "[overlay@/home/tomas/.local/share/containers/storage+/run/user/1000/containers]@4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] exporting opaque data as blob "sha256:4070d12a8d3f1b7015c9ce7aa2bbfa191c3b5b4045c8ed559544be84779b4849"
DEBU[0000] overlay: mount_data=,lowerdir=/home/tomas/.local/share/containers/storage/overlay/l/MNZJPZ3W2AGTDD2HC4525YSUUI:/home/tomas/.local/share/containers/storage/overlay/l/CNCVADD6DSMOLBVFSBWNPUEHOM:/home/tomas/.local/share/containers/storage/overlay/l/BVQ3WNLTQXTPUP3BOQ4WKUP4YK:/home/tomas/.local/share/containers/storage/overlay/l/PP7FHT63BMSMKCXOKA4BBW6ACH,upperdir=/home/tomas/.local/share/containers/storage/overlay/47e71c685a09eb82f2404234565e049e2521fd7c024f3ab2d610287ab096343d/diff,workdir=/home/tomas/.local/share/containers/storage/overlay/47e71c685a09eb82f2404234565e049e2521fd7c024f3ab2d610287ab096343d/work,userxattr

....waiting here for a long time.....

DEBU[4506] created container "340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4"
DEBU[4506] container "340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4" has work directory "/home/tomas/.local/share/containers/storage/overlay-containers
/340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata"
DEBU[4506] container "340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4" has run directory "/run/user/1000/containers/overlay-containers/340bad722e32ec5f43
8351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata"
DEBU[4506] [graphdriver] trying provided driver "overlay"
DEBU[4506] cached value indicated that overlay is supported
DEBU[4506] cached value indicated that metacopy is not being used
DEBU[4506] backingFs=xfs, projectQuotaSupported=false, useNativeDiff=false, usingMetacopy=false
DEBU[4506] overlay: mount_data=,lowerdir=/home/tomas/.local/share/containers/storage/overlay/l/MJBDUS3AHCLSVJ3VOZNHMMZ6K2:/home/tomas/.local/share/containers/storage/over
lay/l/MJBDUS3AHCLSVJ3VOZNHMMZ6K2/../diff1:/home/tomas/.local/share/containers/storage/overlay/l/MNZJPZ3W2AGTDD2HC4525YSUUI:/home/tomas/.local/share/containers/storage/ove
rlay/l/CNCVADD6DSMOLBVFSBWNPUEHOM:/home/tomas/.local/share/containers/storage/overlay/l/BVQ3WNLTQXTPUP3BOQ4WKUP4YK:/home/tomas/.local/share/containers/storage/overlay/l/P
P7FHT63BMSMKCXOKA4BBW6ACH,upperdir=/home/tomas/.local/share/containers/storage/overlay/f2277113e202de472896022e192feeeb5c2bfb2c02764f89a9e463121483895d/diff,workdir=/home
/tomas/.local/share/containers/storage/overlay/f2277113e202de472896022e192feeeb5c2bfb2c02764f89a9e463121483895d/work,userxattr,context="system_u:object_r:container_file_t
:s0:c229,c299"
DEBU[4506] mounted container "340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4" at "/home/tomas/.local/share/containers/storage/overlay/f2277113e202de4728
96022e192feeeb5c2bfb2c02764f89a9e463121483895d/merged"
DEBU[4506] Created root filesystem for container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 at /storage/ram/containers/storage/overlay/f2277113e202d
e472896022e192feeeb5c2bfb2c02764f89a9e463121483895d/merged
DEBU[4506] Workdir "/go/src/github.com/openshift/origin" resolved to host path "/storage/ram/containers/storage/overlay/f2277113e202de472896022e192feeeb5c2bfb2c02764f89a9
e463121483895d/merged/go/src/github.com/openshift/origin"
DEBU[4506] Modifying container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 /etc/passwd
DEBU[4506] Modifying container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 /etc/group
DEBU[4506] /etc/system-fips does not exist on host, not mounting FIPS mode subscription
DEBU[4506] Setting CGroups for container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 to user.slice:libpod:340bad722e32ec5f438351269afea435deb1f6087d7
b2b3ec030e656392c88f4
DEBU[4506] reading hooks from /usr/share/containers/oci/hooks.d
DEBU[4506] Created OCI spec for container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 at /home/tomas/.local/share/containers/storage/overlay-containers/340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata/config.json
DEBU[4506] /usr/bin/conmon messages will be logged to syslog
DEBU[4506] running conmon: /usr/bin/conmon               args="[--api-version 1 -c 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 -u 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 -r /usr/bin/crun -b /home/tomas/.local/share/containers/storage/overlay-containers/340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata -p /run/user/1000/containers/overlay-containers/340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata/pidfile -n cool_franklin --exit-dir /run/user/1000/libpod/tmp/exits --full-attach -s -l k8s-file:/home/tomas/.local/share/containers/storage/overlay-containers/340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata/ctr.log --log-level debug --syslog --conmon-pidfile /run/user/1000/containers/overlay-containers/340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4/userdata/conmon.pid --exit-command /usr/bin/podman --exit-command-arg --root --exit-command-arg /home/tomas/.local/share/containers/storage --exit-command-arg --runroot --exit-command-arg /run/user/1000/containers --exit-command-arg --log-level --exit-command-arg debug --exit-command-arg --cgroup-manager --exit-command-arg systemd --exit-command-arg --tmpdir --exit-command-arg /run/user/1000/libpod/tmp --exit-command-arg --runtime --exit-command-arg crun --exit-command-arg --storage-driver --exit-command-arg overlay --exit-command-arg --events-backend --exit-command-arg journald --exit-command-arg --syslog --exit-command-arg container --exit-command-arg cleanup --exit-command-arg 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4]"
INFO[4506] Running conmon under slice user.slice and unitName libpod-conmon-340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4.scope
[conmon:d]: failed to write to /proc/self/oom_score_adj: Permission denied

DEBU[4506] Received: 41746
INFO[4506] Got Conmon PID as 41742
DEBU[4506] Created container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 in OCI runtime
DEBU[4506] slirp4netns command: /usr/bin/slirp4netns --disable-host-loopback --mtu=65520 --enable-sandbox --enable-seccomp -c -e 3 -r 4 41746 tap0
DEBU[4506] Starting container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4 with command [echo done]
DEBU[4506] Started container 340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4
340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4
DEBU[4507] Called run.PersistentPostRunE(/usr/bin/podman --log-level debug run --userns keep-id -d -v /storage/ram/tomas/Development/src/github/openshift/managed-upgrade-operator:/go/src/github.com/openshift/managed-upgrade-operator:Z quay.io/app-sre/boilerplate:image-v1.0.0 echo done)

real    75m7.246s
user    0m7.661s
sys     0m49.477s

Remove container and look at images

Note size increased by 4gb


[tomas@dev-vm managed-upgrade-operator]$ podman rm $(podman ps -aq)
340bad722e32ec5f438351269afea435deb1f6087d7b2b3ec030e656392c88f4
[tomas@dev-vm managed-upgrade-operator]$ podman images
REPOSITORY                   TAG           IMAGE ID      CREATED      SIZE
quay.io/app-sre/boilerplate  image-v1.0.0  4070d12a8d3f  5 weeks ago  6.22 GB


Run container second time with --userns keep-id


[tomas@dev-vm managed-upgrade-operator]$ time /usr/bin/podman run --userns keep-id -d -v /storage/ram/tomas/Development/src/github/openshift/managed-upgrade-operator:/go/src/github.com/openshift/managed-upgrade-operator:Z quay.io/app-sre/boilerplate:image-v1.0.0 echo done
1ff928988513b7d884a8360249b93495d3e93309623faf0175e223da1bc8617b

real    0m0.786s
user    0m0.159s
sys     0m0.114s
[tomas@dev-vm managed-upgrade-operator]$ podman rm $(podman ps -aq)
1ff928988513b7d884a8360249b93495d3e93309623faf0175e223da1bc8617b


`realpath` doesn't natively exist on macOS

while running commands on my new machine I saw this error:

+++ realpath boilerplate/openshift/golang-osd-operator/ensure.sh
/Users/rogreen/Repo/route-monitor-operator/boilerplate/_lib/common.sh: line 146: realpath: command not found

and I saw that realpath can be used in coreutils and should be exported to the PATH variable before the defaults

also I found a macOS compatible function to get realpath https://stackoverflow.com/a/3572105

SOURCER=$(realpath $0)

Allow Configurable Path For config.go

Some repos have their config.go in different path(s). The config.go parsing fails in this case. Add better prereq checks before parsing:

$ make
#boilerplate/_lib/ensure.sh golangci-lint
# GOLANGCI_LINT_CACHE needs to be set to a directory which is writeable
# Relevant issue - https://github.com/golangci/golangci-lint/issues/734
GOLANGCI_LINT_CACHE=/tmp/golangci-cache golangci-lint run -c boilerplate/openshift/golang_osd_cluster_operator/golangci.yml ./...
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GOFLAGS= go test  github.com/openshift/must-gather-operator/cmd/manager github.com/openshift/must-gather-operator/pkg/apis github.com/openshift/must-gather-operator/pkg/apis/mustgather github.com/openshift/must-gather-operator/pkg/apis/mustgather/v1alpha1 github.com/openshift/must-gather-operator/pkg/config github.com/openshift/must-gather-operator/pkg/controller github.com/openshift/must-gather-operator/pkg/controller/mustgather github.com/openshift/must-gather-operator/version
?   	github.com/openshift/must-gather-operator/cmd/manager	[no test files]
?   	github.com/openshift/must-gather-operator/pkg/apis	[no test files]
?   	github.com/openshift/must-gather-operator/pkg/apis/mustgather	[no test files]
?   	github.com/openshift/must-gather-operator/pkg/apis/mustgather/v1alpha1	[no test files]
?   	github.com/openshift/must-gather-operator/pkg/config	[no test files]
?   	github.com/openshift/must-gather-operator/pkg/controller	[no test files]
?   	github.com/openshift/must-gather-operator/pkg/controller/mustgather	[no test files]
?   	github.com/openshift/must-gather-operator/version	[no test files]
sed: config/config.go: No such file or directory
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GOFLAGS= go build -gcflags="all=-trimpath=/Users/dustinrow/.gvm/pkgsets/go1.13.6/global" -asmflags="all=-trimpath=/Users/dustinrow/.gvm/pkgsets/go1.13.6/global" -o build/_output/bin/ ./cmd/manager
if [ "" == "true" ]; then \
		docker run --rm -v `pwd -P`:`pwd -P` python:2.7.15 /bin/sh -c "cd `pwd`; pip install oyaml; `pwd`/"; \
	else \
		; \
	fi
bash: -c: line 0: syntax error near unexpected token `;'
bash: -c: line 0: `if [ "" == "true" ]; then 	docker run --rm -v `pwd -P`:`pwd -P` python:2.7.15 /bin/sh -c "cd `pwd`; pip install oyaml; `pwd`/"; else 	; fi'
make: *** [generate-syncset] Error 2

golangci-lint version check for existing binary

#22 added logic to skip installing the golangci-lint binary if one already exists in your PATH. But if this path is taken, we're ignoring $GOLANGCI_LINT_VERSION and could end up using the wrong one. So this path ought to include a version check. See this comment.

Dependency Installation Broken For golangci-lint

The golangci-lint is broken. I'm using gvm and on a mac.

boilerplate/_lib/ensure.sh golangci-lint
tar: could not chdir to '/Users/dustinrow/.gvm/pkgsets/go1.13.6/global/bin'

make: *** [gocheck] Error 1

onboard operator-sdk >= 1

two Issues I found so far:

1

sed: can't read build/Dockerfile: No such file or directory

the file is saved the the /Dockerfile location.. solved by

mkdir build
ln -s ../Dockerfile build/Dockerfile

2

on macos

sed: 1: "build/Dockerfile": undefined label 'uild/Dockerfile'

no solution found so far

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.