Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pre-commit-check:
echo "Note: Install pre-commit hooks by 'pre-commit install' and you'll never have to run this check manually again."

check-failures: check-test-lib
cd tests/failures/check && make tag && ! make check && make clean
cd tests/failures/check && make build && ! make check && make clean
cd tests/failures/check && ./check_skip_squash.sh

check-latest-imagestream:
Expand Down
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ during the build.
`make build` will also expect a `README.md` so that it can transform it into
a man page that gets added to the image so make sure it is available and that
you have the `go-md2man` tool installed on your host.


`make tag`
Use this rule if you want to tag an image after it is built. It will be tagged with
The image will be tagged after it is built. It will be tagged with
two tags - name:latest and name:version.
Depends on `build`

`make test` or `make check`
This rule will run the testsuite scripts contained in the container source repositories.
Expand Down Expand Up @@ -63,6 +59,21 @@ E.g. command for the source generation into Fedora dist-repo
The sources are not generated directly into dist-git repository,
but into created `results` directory.

`make version-table`
Generates a version table in the main `README.md` file that shows which versions of the software
are provided for each OS as images. In order to generate a table, install `python-natsort`
(or the `natsort` package from PyPI), then insert the following two
comments into the `README`:
```md
<!--
Table start
-->
<!--
Table end
-->
```
in **this exact** format, and finally run `make version-table` to generate it.

`make clean`
Runs scripts that clean-up the working dir. Depends on the `clean-images` rule by default
and additional clean rules can be provided through the `clean-hook` variable.
Expand Down
20 changes: 20 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,26 @@ function docker_build_with_version {
# IMAGE_ID
# analyze_logs_by_logdetective "$?" "${tmp_file}"
echo "$IMAGE_ID" > .image-id
tag_image
}

function tag_image {
name=$(docker inspect -f "{{.Config.Labels.name}}" "$IMAGE_ID") || (echo "-> No image with this tag found, try re-building." && return)
# We need to check '.git' dir in root directory
if [ -d "../.git" ] ; then
commit_date=$(git show -s HEAD --format=%cd --date=short | sed 's/-//g')
date_and_hash="${commit_date}-$(git rev-parse --short HEAD)"
else
date_and_hash="$(date +%Y%m%d%H%M%S)"
fi

full_reg_name="$REGISTRY$name"
echo "-> Tagging image '$IMAGE_ID' as '$full_reg_name:$dir' and '$full_reg_name:latest' and '$full_reg_name:$OS' and '$full_reg_name:$date_and_hash'"

docker tag "$IMAGE_ID" "$full_reg_name:$OS"
docker tag "$IMAGE_ID" "$full_reg_name:$dir"
docker tag "$IMAGE_ID" "$full_reg_name:latest"
docker tag "$IMAGE_ID" "$full_reg_name:$date_and_hash"
}

# Versions are stored in subdirectories. You can specify VERSION variable
Expand Down
16 changes: 5 additions & 11 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ endif
build = $(SHELL) $(common_dir)/build.sh
test = $(SHELL) $(common_dir)/test.sh
shellcheck = $(SHELL) $(common_dir)/run-shellcheck.sh
tag = $(SHELL) $(common_dir)/tag.sh
clean = $(SHELL) $(common_dir)/clean.sh
betka = $(SHELL) $(common_dir)/betka.sh

Expand Down Expand Up @@ -92,39 +91,34 @@ check: test
test: script_env += TEST_MODE=true

# The tests should ideally depend on $IMAGE_ID only, but see PR#19 for more info
# while we need to depend on 'tag' instead of 'build'.
test: tag
test: build
VERSIONS="$(VERSIONS)" $(script_env) $(test)

.PHONY: test-openshift-4
test-openshift-4: script_env += TEST_OPENSHIFT_4=true
test-openshift-4: tag
test-openshift-4: build
VERSIONS="$(VERSIONS)" BASE_IMAGE_NAME="$(BASE_IMAGE_NAME)" $(script_env) $(test)

.PHONY: test-openshift
test-openshift: script_env += TEST_OPENSHIFT_MODE=true
test-openshift: tag
test-openshift: build
VERSIONS="$(VERSIONS)" BASE_IMAGE_NAME="$(BASE_IMAGE_NAME)" $(script_env) $(test)

.PHONY: test-openshift-pytest
test-openshift-pytest: script_env += TEST_OPENSHIFT_PYTEST=true
test-openshift-pytest: tag
test-openshift-pytest: build
VERSIONS="$(VERSIONS)" BASE_IMAGE_NAME="$(BASE_IMAGE_NAME)" $(script_env) $(test)

.PHONY: test-pytest
test-pytest: script_env += TEST_PYTEST=true
test-pytest: tag
test-pytest: build
VERSIONS="$(VERSIONS)" BASE_IMAGE_NAME="$(BASE_IMAGE_NAME)" $(script_env) $(test)


.PHONY: shellcheck
shellcheck:
$(shellcheck) $(SHELLCHECK_FILES)

.PHONY: tag
tag: build
VERSIONS="$(VERSIONS)" $(script_env) $(tag)

.PHOHY: betka
betka:
VERSIONS="$(VERSIONS)" \
Expand Down
52 changes: 0 additions & 52 deletions tag.sh

This file was deleted.

2 changes: 1 addition & 1 deletion tests/failures/check/check_skip_squash.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

make tag SKIP_SQUASH=0
make build SKIP_SQUASH=0
3 changes: 1 addition & 2 deletions tests/failures/check/v0/Dockerfile.rhel10
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
FROM ubi9/s2i-core
## ubi10/s2i-core does not exist let's use ubi9/s2i-core
FROM ubi10/s2i-core
LABEL name=test-image