From de43f3afb698f9e141145b8715cad396ac08f3e6, both the code and the
commit message used singular form of expand_tag, but the example in the
README used the plural form of expand_tags. Based on that I assume the
singular form was the intention and the plural form in the README was a
typo (the plural form does not work because the code only checks for the
singular form env var).
* Port the auto tag feature from https://plugins.drone.io/drone-plugins/drone-docker
The logic is forked from https://github.com/drone-plugins/drone-docker code base
with necessary modification. I've tested it e2e for DockerHub on my Drone server
via this plugin image https://hub.docker.com/repository/docker/15cm/drone-kaniko,
for both tag pushes and commit pushes.
With this change the .drone.yml in this repo should work as intended.
Other changes:
- Rename the existing "auto tag" flags/code to "expand tag" for a less
misleading naming.
- ATTENTION: make a breaking change to set default value of "--tags" to empty.
Rationale is to expect most users to use the auto tagging feature. When power
users want to specify tags, they should always explicitly set tags instead of
being surprised by the default "latest" tag.
* Change how --auto-tag flag works with other flags
The --auto-tag has to be a breaking change. This commit limit the breaking
impact to the users who enable the flag. Behaviors of flag combination after
this commit:
* --auto-tag=false: No changes.
* --auto-tag=false,--expand-tag=true,tags=1.0.0:
* Old behavior: Should not happen. --expand-tag didn't exist.
* New Behavior: Build with [1,1.0,1.0.0] tags.
* --auto-tag=true
* Old behavior: Build with the "latest" tag.
* New behavior: Build with auto detected tags. Abort if auto detection failed.
* --auto-tag=true,tags=latest: same as "--auto-tag=true".
* --auto-tag=true,tags=1.0.0:
* Old behavior: Build with [1,1.0,1.0.0] tags.
* New behavior: Abort the build with an error message.
* --auto-tag=true,--expand-tag=true,tags=1.0.0: Abort the build with an error message.
Also added a test for the integration of the BUILD struct and the tagger
package, which is used by kaniko.go.
* Update readme to note that expand-tag and auto-tag don't support artifacts
since commit b22e993224, kaniko is cgroupv2-aware.
hotfix of a34e88943a is therefore no longer needed.
Reviewed-on: #1
Co-authored-by: wanderer <wanderer@noreply.git.dotya.ml>
Co-committed-by: wanderer <wanderer@noreply.git.dotya.ml>
This is a temporary workaround that enables kaniko to run on cgroup v2
enabled hosts. Due to an upstream issue, kaniko fails to detect that it
is indeed being run from a container.
Solution introduced here is to force kaniko to run regardless.
ref: https://github.com/GoogleContainerTools/kaniko/issues/1592
* don't exit on no values provided but instead use sane defaults for
username, password and registry
* add "--no-push" flag if REPO name has not been specified
* only allow setting of TAGS if REPO has been specified as well
* rm arm/arm64/gcr/ecr related build instructions in build.sh
and .drone.ml, only build for amd64
* change autotag to manually specified tags (2 static, one dynamic)
* change the branch referenced in .drone.yml as we're using dev by
default
* module path is now git.dotya.ml/wanderer/drone-kaniko/*