mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
copy cache before it's deleted
This commit is contained in:
parent
7b787903d4
commit
a904df0f87
3 changed files with 8 additions and 2 deletions
5
Makefile
5
Makefile
|
|
@ -15,7 +15,7 @@ EXTRA_BOOT_PARAMS =
|
||||||
ROOTFS_SIZE = 4
|
ROOTFS_SIZE = 4
|
||||||
DNF_CACHE =
|
DNF_CACHE =
|
||||||
|
|
||||||
# Generated vars
|
# Generated/internal vars
|
||||||
## Formatting = _UPPERCASE
|
## Formatting = _UPPERCASE
|
||||||
_BASE_DIR = $(shell pwd)
|
_BASE_DIR = $(shell pwd)
|
||||||
_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO))
|
_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO))
|
||||||
|
|
@ -23,6 +23,8 @@ _IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED))
|
||||||
_VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
|
_VOLID = $(firstword $(subst -, ,$(IMAGE_NAME)))-$(ARCH)-$(IMAGE_TAG)
|
||||||
_REPO_FILES = $(subst /etc/yum.repos.d,repos,$(REPOS))
|
_REPO_FILES = $(subst /etc/yum.repos.d,repos,$(REPOS))
|
||||||
_LORAX_TEMPLATES = $(subst .in,,$(shell ls lorax_templates/*.tmpl.in)) $(foreach file,$(shell ls lorax_templates/scripts/post),lorax_templates/post_$(file).tmpl)
|
_LORAX_TEMPLATES = $(subst .in,,$(shell ls lorax_templates/*.tmpl.in)) $(foreach file,$(shell ls lorax_templates/scripts/post),lorax_templates/post_$(file).tmpl)
|
||||||
|
_EXCLUDED_TEMPLATES = lorax_templates/copy_dnf_cache.tpml.in
|
||||||
|
_LORAX_TEMPLATES = $(filter-out $(_EXCLUDED_TEMPLATES),$(_LORAX_TEMPLATES))
|
||||||
_TEMPLATE_VARS = ARCH VERSION IMAGE_REPO IMAGE_NAME IMAGE_TAG VARIANT WEB_UI REPOS _IMAGE_REPO_ESCAPED _IMAGE_REPO_DOUBLE_ESCAPED ENROLLMENT_PASSWORD
|
_TEMPLATE_VARS = ARCH VERSION IMAGE_REPO IMAGE_NAME IMAGE_TAG VARIANT WEB_UI REPOS _IMAGE_REPO_ESCAPED _IMAGE_REPO_DOUBLE_ESCAPED ENROLLMENT_PASSWORD
|
||||||
_LORAX_ARGS =
|
_LORAX_ARGS =
|
||||||
|
|
||||||
|
|
@ -40,6 +42,7 @@ endif
|
||||||
|
|
||||||
ifneq ($(DNF_CACHE),)
|
ifneq ($(DNF_CACHE),)
|
||||||
_LORAX_ARGS += --cachedir $(DNF_CACHE)
|
_LORAX_ARGS += --cachedir $(DNF_CACHE)
|
||||||
|
_LORAX_TEMPLATES += lorax_templates/copy_dnf_cache.tpml.in
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Step 7: Buid end ISO
|
# Step 7: Buid end ISO
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ runs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir /cache/dnf || true
|
mkdir /cache/dnf || true
|
||||||
|
mkdir /cache/dnf_new || true
|
||||||
mkdir /cache/skopeo || true
|
mkdir /cache/skopeo || true
|
||||||
|
|
||||||
- name: Run docker image
|
- name: Run docker image
|
||||||
|
|
@ -101,6 +102,7 @@ runs:
|
||||||
if [[ -z "${tag}" ]]; then tag=${{ github.action_ref }}; fi
|
if [[ -z "${tag}" ]]; then tag=${{ github.action_ref }}; fi
|
||||||
if [[ "${{ inputs.enable_cache_dnf }}" == "true" ]]; then cache="${cache} -v /cache/dnf:/cache/dnf"; fi
|
if [[ "${{ inputs.enable_cache_dnf }}" == "true" ]]; then cache="${cache} -v /cache/dnf:/cache/dnf"; fi
|
||||||
if [[ "${{ inputs.enable_cache_skopeo }}" == "true" ]]; then cache="${cache} -v /cache/skopeo:/cache/skopeo"; fi
|
if [[ "${{ inputs.enable_cache_skopeo }}" == "true" ]]; then cache="${cache} -v /cache/skopeo:/cache/skopeo"; fi
|
||||||
|
if [[ "${{ steps.load_dnf_cache.outputs.cache-hit}}" == "false" ]]; then cache="${cache} -v /cache/dnf_new:/cache/dnf_new"; fi
|
||||||
docker run --privileged --volume ${{ github.workspace }}:/github/workspace/ ${cache} ghcr.io/jasonn3/build-container-installer:${tag} \
|
docker run --privileged --volume ${{ github.workspace }}:/github/workspace/ ${cache} ghcr.io/jasonn3/build-container-installer:${tag} \
|
||||||
ARCH=${{ inputs.arch }} \
|
ARCH=${{ inputs.arch }} \
|
||||||
IMAGE_NAME=${{ inputs.image_name }} \
|
IMAGE_NAME=${{ inputs.image_name }} \
|
||||||
|
|
@ -120,7 +122,7 @@ runs:
|
||||||
if: inputs.enable_cache_dnf == 'true' && steps.load_dnf_cache.outputs.cache-hit == 'false'
|
if: inputs.enable_cache_dnf == 'true' && steps.load_dnf_cache.outputs.cache-hit == 'false'
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: /cache/dnf
|
path: /cache/dnf_new
|
||||||
key: ${{ inputs.dnf_cache_key || env.dnf_cache_key }}
|
key: ${{ inputs.dnf_cache_key || env.dnf_cache_key }}
|
||||||
|
|
||||||
- name: Save skopeo cache
|
- name: Save skopeo cache
|
||||||
|
|
|
||||||
1
lorax_templates/copy_dnf_cache.tmpl.in
Normal file
1
lorax_templates/copy_dnf_cache.tmpl.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
runcmd "bash -c 'if [[ -d /cache/dnf_new ]]; then cp -R /cache/dnf /cache/dnf_new; fi'"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue