Skip to content

Commit

Permalink
Merge pull request #698 from gerrod3/app-fixes
Browse files Browse the repository at this point in the history
Fix app-rebuild logic
  • Loading branch information
gerrod3 authored Dec 5, 2024
2 parents 264f0c2 + 50ac763 commit 33ec895
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/actions/build_image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runs:
python-version: 3.11

- name: Install python deps
run: pip install httpie jq
run: pip install httpie jq packaging
shell: bash

- name: Restore podman images from cache
Expand Down Expand Up @@ -85,21 +85,17 @@ runs:
# 1. CI is being ran in a PR or is a nightly run
# 2. Base images were rebuilt
# 3. New pulp versions was released
if [[ "${{ github.event_name }}" == "pull_request" || "${{ inputs.image_variant }}" == "nightly" || -n "${{ inputs.built_base_images }}" ]]; then
echo "BUILD=true" >> $GITHUB_ENV
else
if [[ "${{ steps.cache.outputs.cache-hit }}" == "false" ]]; then
echo "BUILD=true" >> $GITHUB_ENV
else
build=true
if [[ "${{ github.event_name }}" != "pull_request" && "${{ inputs.image_variant }}" != "nightly" && -z "${{ inputs.built_base_images }}" ]]; then
if [[ "${{ steps.cache.outputs.cache-hit }}" == "true" ]]; then
# Script returns non-zero (100) when new versions are available
if python .ci/scripts/check_up_to_date.py ${{ github.ref_name }} versions.freeze; then
echo "BUILD=false" >> $GITHUB_ENV
else
echo "BUILD=true" >> $GITHUB_ENV
build=false
fi
fi
fi
echo "Going to rebuild: ${BUILD}"
echo "BUILD=${build}" >> $GITHUB_ENV
echo "Going to rebuild: ${build}"
shell: bash

- name: Build images
Expand All @@ -125,14 +121,15 @@ runs:
id: image_version_branch
run: |
base_image=$(echo ${{ inputs.image_name }} | cut -d '-' -f1)
podman run --pull=never pulp/${{ inputs.image_name }}:ci-amd64 bash -c "pip3 freeze | grep pulp" >> versions.freeze
app_version=$(grep pulpcore versions.freeze | sed -n -e 's/pulpcore==//p')
app_version=$(podman run --pull=never pulp/${{ inputs.image_name }}:ci-amd64 bash -c "pip3 show pulpcore | sed -n -e 's/Version: //p'")
app_branch=$(echo ${app_version} | grep -oP '\d+\.\d+')
podman run --pull=never pulp/${{ inputs.image_name }}:ci-amd64 bash -c "pip3 freeze | grep pulp" > versions.freeze
echo "APP_VERSION: ${app_version}"
echo "APP_BRANCH: ${app_branch}"
echo "app_version=${app_version}" >> "$GITHUB_OUTPUT"
echo "app_branch=${app_branch}" >> "$GITHUB_OUTPUT"
cat versions.freeze
shell: bash

- name: Clear cache for next upload
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ jobs:
image_cache_key: ${{ needs.base-images.outputs.base_cache_key }}
latest_ui: ${{ github.ref_name == 'latest' }}
built_base_images: ${{ needs.base-images.outputs.rebuilt_images }}
env:
GH_TOKEN: ${{ github.token }}


- name: Test App Image
Expand Down

0 comments on commit 33ec895

Please sign in to comment.