Created
February 21, 2023 15:44
-
-
Save mikedep333/d06d3ca00a5d413af08f9a0ce9ac1b63 to your computer and use it in GitHub Desktop.
Recent changes to https://github.com/pulp/pulp-oci-images/pull/435
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/.ci/scripts/update_ci_branches.py b/.ci/scripts/update_ci_branches.py | |
| index 4d92d8c..aecc997 100755 | |
| --- a/.ci/scripts/update_ci_branches.py | |
| +++ b/.ci/scripts/update_ci_branches.py | |
| @@ -13,7 +13,7 @@ github_api = "https://api.github.com" | |
| for branch in branches: | |
| print(f"Updating {branch}") | |
| - if type(branch) == float and ( branch < 3.22 ): | |
| + if type(branch) == float and branch < 3.22 : | |
| workflow_path = "/actions/workflows/publish_images.yaml/dispatches" | |
| else: | |
| workflow_path = "/actions/workflows/pulp_images.yml/dispatches" | |
| diff --git a/.github/workflows/pulp_images.yml b/.github/workflows/pulp_images.yml | |
| index ceff8b4..43b4922 100644 | |
| --- a/.github/workflows/pulp_images.yml | |
| +++ b/.github/workflows/pulp_images.yml | |
| @@ -75,6 +75,11 @@ jobs: | |
| uses: actions/setup-python@v1 | |
| with: | |
| python-version: '3.8' | |
| + - name: Dispatching | |
| + if: github.event_name == 'schedule' | |
| + run: python .ci/scripts/update_ci_branches.py | |
| + env: | |
| + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| - name: Build images | |
| run: | | |
| podman version | |
| @@ -139,11 +144,6 @@ jobs: | |
| echo ::group::PYDEPS | |
| pip install gitpython requests packaging jinja2 pyyaml | |
| echo ::endgroup:: | |
| - - name: Dispatching | |
| - if: github.event_name == 'schedule' | |
| - run: python .ci/scripts/update_ci_branches.py | |
| - env: | |
| - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| - name: Restore podman images from cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| @@ -176,7 +176,7 @@ jobs: | |
| - name: Set version and branch image tags | |
| run: | | |
| app_version=$(podman run pulp/${{ matrix.app.image_name }}:stable bash -c "pip3 show ${{ matrix.app.pip_name }} | sed -n -e 's/Version: //p'") | |
| - app_branch=$(echo ${app_version} | grep -P '\d+\.\d+') | |
| + app_branch=$(echo ${app_version} | grep -oP '\d+\.\d+') | |
| echo "APP_VERSION: ${app_version}" | |
| echo "APP_BRANCH: ${app_branch}" | |
| @@ -184,7 +184,7 @@ jobs: | |
| echo "APP_BRANCH=${app_branch}" >> $GITHUB_ENV | |
| base_version=$(podman run pulp/${{ matrix.app.image_name }}:stable bash -c "pip3 show pulpcore | sed -n -e 's/Version: //p'") | |
| - base_branch=$(echo ${base_version} | grep -P '\d+\.\d+') | |
| + base_branch=$(echo ${base_version} | grep -oP '\d+\.\d+') | |
| echo "BASE_VERSION: ${base_version}" | |
| echo "BASE_BRANCH: ${base_branch}" | |
| @@ -213,10 +213,10 @@ jobs: | |
| podman rm pulp | |
| - name: Compose up | |
| run: | | |
| - # FIXME: Remove this line after finishing debuggin | |
| - set -x | |
| if [ "${{ matrix.app.s6 }}" == "true" ]; then | |
| + # Reuse the folders from the s6 mode tests | |
| FILE="docker-compose.folders.yml" | |
| + # We'll pull the web image from a registry since we didn't build it. | |
| WEB_TAG="${APP_BRANCH}" | |
| else | |
| FILE="docker-compose.yml" | |
| @@ -272,38 +272,51 @@ jobs: | |
| QUAY_BOT_PASSWORD: ${{ secrets.QUAY_BOT_PASSWORD }} | |
| QUAY_BOT_USERNAME: ${{ secrets.QUAY_BOT_USERNAME }} | |
| run: echo "$QUAY_BOT_PASSWORD" | podman login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io | |
| - - name: Push images to registries | |
| + - name: Push base images to registries | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| for registry in gchr.io docker.io quay.io; do | |
| - | |
| # Technically multiple jobs will build and push these 2 images | |
| # but it is created once in the base-images job, and will be identical | |
| - # | |
| - # Also, if we are doing a tag/release job, BRANCH will actually be the VERSION. | |
| for image_name_looped in base pulp-ci-centos; do | |
| - podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:${BASE_BRANCH} | |
| - podman push ${registry}/pulp/${image_name_looped}:${BASE_BRANCH} | |
| - | |
| - podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:${BASE_VERSION} | |
| - podman push ${registry}/pulp/${image_name_looped}:${BASE_VERSION} | |
| - done | |
| - | |
| - for {{ matrix.app.image_name }} ${{ matrix.app.web_image }}; do | |
| - # "nightly" image and "stable" alias only get published for the "latest" branch | |
| - if [["${TEMP_TAG}" == "latest" ]]; then | |
| - podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:${{ matrix.image_variant }} | |
| - podman push ${registry}/pulp/${image_name_looped}:${{ matrix.image_variant }} | |
| + if [ "${TEMP_TAG}" == "latest" ]; then | |
| + tags="${BASE_BRANCH} ${BASE_VERSION} latest" | |
| + else | |
| + tags="${BASE_BRANCH} ${BASE_VERSION}" | |
| fi | |
| - if [[ "${{ matrix.image_variant }}" == "stable" ]]; then | |
| - podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:$(APP_BRANCH} | |
| - podman push ${registry}/pulp/${image_name_looped}:$(APP_BRANCH} | |
| - | |
| - podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:$(APP_VERSION} | |
| - podman push ${registry}/pulp/${image_name_looped}:$(APP_VERSION} | |
| + for tag in $tags; do | |
| + podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:${tag} | |
| + podman push ${registry}/pulp/${image_name_looped}:${tag} | |
| + done | |
| + done | |
| + unset tag | |
| + shell: bash | |
| + - name: Push app images to registries | |
| + if: github.event_name != 'pull_request' | |
| + run: | | |
| + for registry in gchr.io docker.io quay.io; do | |
| + for image_name_looped in ${{ matrix.app.image_name }} ${{ matrix.app.web_image }}; do | |
| + if [ "${{ matrix.image_variant }}" == "stable" ]; then | |
| + # latest branch stable variant gets tagged as both "latest" and "stable" | |
| + if [ "${TEMP_TAG}" == "latest" ]; then | |
| + tags="${APP_BRANCH} ${APP_VERSION} ${{ matrix.image_variant }} latest" | |
| + else | |
| + tags="${APP_BRANCH} ${APP_VERSION}" | |
| + fi | |
| + else | |
| + # The matrix should ensure that the nightly variant only ever pertains to the "latest" branch, but let's be extra safe | |
| + if [ "${TEMP_TAG}" == "latest" ]; then | |
| + # "nightly" is a special case, no version / branch tags | |
| + tags="${{ matrix.image_variant }}" | |
| + fi | |
| fi | |
| + for tag in $tags; do | |
| + podman tag pulp/${image_name_looped}:${TEMP_TAG} ${registry}/pulp/${image_name_looped}:${tag} | |
| + podman push ${registry}/pulp/${image_name_looped}:${tag} | |
| + done | |
| done | |
| done | |
| + shell: bash | |
| - name: Logs | |
| if: always() | |
| run: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment