Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI changes for new k8s images #560

Merged
merged 6 commits into from
Oct 26, 2023
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
4 changes: 1 addition & 3 deletions .github/actions/setup-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ runs:
shell: bash
run: |
find . -name \*.tar
docker load --input full-vertica-image/full-vertica-image.tar
docker load --input nokeys-vertica-image/nokeys-vertica-image.tar
docker load --input minimal-vertica-image/minimal-vertica-image.tar
docker load --input legacy-vertica-image/legacy-vertica-image.tar
docker load --input operator-image/operator-image.tar
docker load --input vlogger-image/vlogger-image.tar
docker image ls -a
Expand Down
218 changes: 52 additions & 166 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ on:
type: string
required: true
full_vertica_image:
description: 'Name of an existing full Vertica server image. If blank we will build one using the default name'
type: string
required: true
nokeys_vertica_image:
description: 'Name of an existing Vertica server image with no keys inside. If blank we will build one using the default name'
description: 'Name of an existing full Vertica server v2 image. If blank we will build one using the default name'
type: string
required: true
minimal_vertica_image:
description: 'Name of an existing minimal Vertica server image. If blank we will build one using the default name'
description: 'Name of an existing minimal Vertica server v2 image. If blank we will build one using the default name'
type: string
required: true
v2_vertica_image:
description: 'Name of a v2 Vertica server image. If blank we will build one using the default name'
legacy_vertica_image:
description: 'Name of an existing full image with admintools and SSH support. Leave blank to build one with the default name'
type: string
required: true
vlogger_image:
Expand All @@ -46,15 +42,12 @@ on:
full-vertica-image:
description: "The image name of the full vertica server image"
value: ${{ jobs.build-server-full.outputs.image }}
nokeys-vertica-image:
description: "The image name of the vertica server image, but with no keys inside"
value: ${{ jobs.build-server-nokeys.outputs.image }}
minimal-vertica-image:
description: "The image name of the vertica server, but with optional software removed"
value: ${{ jobs.build-server-minimal.outputs.image }}
v2-vertica-image:
description: "The image name of the v2 vertica server image"
value: ${{ jobs.build-server-v2.outputs.image }}
legacy-vertica-image:
description: "The image name of the full vertica server image, but with admintools and SSH support"
value: ${{ jobs.build-server-legacy.outputs.image }}
vlogger-image:
description: "The image name of the vertica logger sidecar"
value: ${{ jobs.build-vlogger.outputs.image }}
Expand All @@ -74,24 +67,17 @@ jobs:
image: ${{ steps.full_vertica_image.outputs.value }}
steps:

- name: set lower case owner name
env:
OWNER: '${{ github.repository_owner }}'
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}

- name: Pick the name of the image
uses: spilchen/switch-case-action@v2
chinhtranvan marked this conversation as resolved.
Show resolved Hide resolved
id: full_vertica_image
with:
default: ghcr.io/${{ env.OWNER_LC }}/vertica-k8s:${{ github.sha }}
default: docker.io/vertica/vertica-k8s-private:latest-master
conditionals-with-values: |
${{ inputs.full_vertica_image != '' }} => ${{ inputs.full_vertica_image }}
${{ github.event_name == 'pull_request' }} => vertica-k8s:kind

- name: Login to GitHub Container registry for non-PRs
uses: docker/login-action@v2
chinhtranvan marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ github.event_name != 'pull_request' && inputs.full_vertica_image == '' || startsWith(inputs.full_vertica_image, 'ghcr.io') }}
if: ${{ github.event_name != 'pull_request' && startsWith(inputs.full_vertica_image, 'ghcr.io') }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -111,26 +97,16 @@ jobs:
uses: ./.github/actions/download-rpm
if: ${{ inputs.full_vertica_image == '' }}

- name: Build and optionally push full server image
- name: Build the full server image
if: ${{ inputs.full_vertica_image == '' }}
run: |
export VERTICA_IMG=${{ steps.full_vertica_image.outputs.value }}
make docker-build-vertica
if [ $GITHUB_EVENT_NAME != 'pull_request' ]
then
make docker-push-vertica
fi

- name: Save the image for consumption by dependent jobs (PRs only)
if: ${{ github.event_name == 'pull_request' }}
run: |
docker save ${{ steps.full_vertica_image.outputs.value }} > full-vertica-image.tar

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: full-vertica-image
path: full-vertica-image.tar
Comment on lines -129 to -133
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed so that the full image is available for later stages.

# We never push the image we build here because the RPM we use is too
# old. The RPM needs to be from at least a 23.3.0 server. So, we build
# here only to test the creation of the image. We don't verify this
# image in the remaining CI. Pick a dummy image name so as not to
# overwrite the output build image that the e2e tests will use.
export VERTICA_IMG=vertica-k8s:kind
make docker-build-vertica-v2

- name: Do a local pull of the image if we didn't create it
if: ${{ inputs.full_vertica_image != '' }}
Expand Down Expand Up @@ -186,10 +162,10 @@ jobs:
echo -n $(docker inspect --format '{{index .Config.Labels "vertica-version"}}' ${{ steps.full_vertica_image.outputs.value }}) >> $GITHUB_STEP_SUMMARY
echo "**" >> $GITHUB_STEP_SUMMARY

build-server-nokeys:
build-server-legacy:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.nokeys_vertica_image.outputs.value }}
image: ${{ steps.legacy_vertica_image.outputs.value }}
steps:

- name: set lower case owner name
Expand All @@ -200,40 +176,39 @@ jobs:

- name: Pick the name of the image
uses: spilchen/switch-case-action@v2
id: nokeys_vertica_image
id: legacy_vertica_image
with:
default: ghcr.io/${{ env.OWNER_LC }}/vertica-k8s:${{ github.sha }}-nokeys
default: ghcr.io/${{ env.OWNER_LC }}/vertica-k8s:${{ github.sha }}-legacy
conditionals-with-values: |
${{ inputs.nokeys_vertica_image != '' }} => ${{ inputs.nokeys_vertica_image }}
${{ github.event_name == 'pull_request' }} => vertica-k8s:kind-nokeys
${{ inputs.legacy_vertica_image != '' }} => ${{ inputs.legacy_vertica_image }}
${{ github.event_name == 'pull_request' }} => vertica-k8s:kind-legacy

- name: Login to GitHub Container registry for non-PRs
uses: docker/login-action@v2
if: ${{ github.event_name != 'pull_request' && inputs.nokeys_vertica_image == '' || startsWith(inputs.nokeys_vertica_image, 'ghcr.io') }}
if: ${{ github.event_name != 'pull_request' && inputs.legacy_vertica_image == '' || startsWith(inputs.legacy_vertica_image, 'ghcr.io') }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ inputs.nokeys_vertica_image != '' && startsWith(inputs.nokeys_vertica_image, 'docker.io') }}
if: ${{ inputs.legacy_vertica_image != '' && startsWith(inputs.legacy_vertica_image, 'docker.io') }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: actions/checkout@v3
if: ${{ inputs.nokeys_vertica_image == '' }}
if: ${{ inputs.legacy_vertica_image == '' }}

- name: Download the RPM
uses: ./.github/actions/download-rpm
if: ${{ inputs.nokeys_vertica_image == '' }}
if: ${{ inputs.legacy_vertica_image == '' }}

- name: Build and optionally push nokeys server image
if: ${{ inputs.nokeys_vertica_image == '' }}
- name: Build and optionally push legacy server image
if: ${{ inputs.legacy_vertica_image == '' }}
run: |
export VERTICA_IMG=${{ steps.nokeys_vertica_image.outputs.value }}
export NO_KEYS=yes
export VERTICA_IMG=${{ steps.legacy_vertica_image.outputs.value }}
make docker-build-vertica
if [ $GITHUB_EVENT_NAME != 'pull_request' ]
then
Expand All @@ -243,127 +218,48 @@ jobs:
- name: Save the image for consumption by dependent jobs (PRs only)
if: ${{ github.event_name == 'pull_request' }}
run: |
docker save ${{ steps.nokeys_vertica_image.outputs.value }} > nokeys-vertica-image.tar
docker save ${{ steps.legacy_vertica_image.outputs.value }} > legacy-vertica-image.tar

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: nokeys-vertica-image
path: nokeys-vertica-image.tar

- name: Do a local pull of the image if we didn't create it
if: ${{ inputs.nokeys_vertica_image != '' }}
run: |
docker pull ${{ inputs.nokeys_vertica_image }}

- name: Print a summary of the job
run: |
echo "Image Name: **${{ steps.nokeys_vertica_image.outputs.value }}**" >> $GITHUB_STEP_SUMMARY
echo "Was Built: ${{ inputs.nokeys_vertica_image == '' && '**Yes**' || '**No**' }}" >> $GITHUB_STEP_SUMMARY
echo "Was Pushed: ${{ inputs.nokeys_vertica_image == '' && github.event_name != 'pull_request' && '**Yes**' || '**No**' }}"
echo "Was Scanned: **No**" >> $GITHUB_STEP_SUMMARY
echo "Size: **$(docker inspect --format '{{.Size}}' ${{ steps.nokeys_vertica_image.outputs.value }} | numfmt --to=iec)**" >> $GITHUB_STEP_SUMMARY
echo "Image ID: **$(docker inspect --format '{{.ID}}' ${{ steps.nokeys_vertica_image.outputs.value }})**" >> $GITHUB_STEP_SUMMARY
echo "Digest: **$(IFS=":" read image tag <<< $(echo ${{ steps.nokeys_vertica_image.outputs.value }} | sed -e 's/^docker.io\///'); docker inspect --format='{{.RepoDigests}}' $image:$tag | sed 's:^.\(.*\).$:\1:' | tr " " "\n" | grep $image | cut -d'@' -f2 || echo "<none>")**" >> $GITHUB_STEP_SUMMARY
echo -n "Vertica Version: **" >> $GITHUB_STEP_SUMMARY
echo -n $(docker inspect --format '{{index .Config.Labels "vertica-version"}}' ${{ steps.nokeys_vertica_image.outputs.value }}) >> $GITHUB_STEP_SUMMARY
echo "**" >> $GITHUB_STEP_SUMMARY

build-server-v2:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.v2_vertica_image.outputs.value }}
steps:

- name: set lower case owner name
env:
OWNER: '${{ github.repository_owner }}'
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}

- name: Pick the name of the image
uses: spilchen/switch-case-action@v2
id: v2_vertica_image
with:
default: docker.io/vertica/vertica-k8s-private:latest-master
conditionals-with-values: |
${{ inputs.v2_vertica_image != '' }} => ${{ inputs.v2_vertica_image }}

- name: Login to GitHub Container registry for non-PRs
uses: docker/login-action@v2
if: ${{ github.event_name != 'pull_request' && inputs.v2_vertica_image == '' || startsWith(inputs.v2_vertica_image, 'ghcr.io') }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ inputs.v2_vertica_image != '' && startsWith(inputs.v2_vertica_image, 'docker.io') }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: actions/checkout@v3
if: ${{ inputs.v2_vertica_image == '' }}

- name: Download the RPM
uses: ./.github/actions/download-rpm
if: ${{ inputs.v2_vertica_image == '' }}

- name: Build the v2 image
if: ${{ inputs.v2_vertica_image == '' }}
run: |
# We never push the image we build here because the RPM we use is too
# old. The RPM needs to be from at least a 23.3.0 server. So, we build
# here only to test the creation of the image. We don't verify this
# image in the remaining CI. Pick a dummy image name so as not to
# overwrite the output build image that the e2e tests will use.
export VERTICA_IMG=vertica-k8s:kind-v2
make docker-build-vertica-v2
name: legacy-vertica-image
path: legacy-vertica-image.tar

- name: Do a local pull of the image if we didn't create it
if: ${{ inputs.v2_vertica_image != '' }}
if: ${{ inputs.legacy_vertica_image != '' }}
run: |
docker pull ${{ inputs.v2_vertica_image }}
docker pull ${{ inputs.legacy_vertica_image }}

- name: Print a summary of the job
run: |
echo "Image Name: **${{ steps.v2_vertica_image.outputs.value }}**" >> $GITHUB_STEP_SUMMARY
echo "Was Built: ${{ inputs.v2_vertica_image == '' && '**Yes**' || '**No**' }}" >> $GITHUB_STEP_SUMMARY
echo "Was Pushed: ${{ inputs.v2_vertica_image == '' && github.event_name != 'pull_request' && '**Yes**' || '**No**' }}"
echo "Image Name: **${{ steps.legacy_vertica_image.outputs.value }}**" >> $GITHUB_STEP_SUMMARY
echo "Was Built: ${{ inputs.legacy_vertica_image == '' && '**Yes**' || '**No**' }}" >> $GITHUB_STEP_SUMMARY
echo "Was Pushed: ${{ inputs.legacy_vertica_image == '' && github.event_name != 'pull_request' && '**Yes**' || '**No**' }}"
echo "Was Scanned: **No**" >> $GITHUB_STEP_SUMMARY
echo "Size: **$(docker inspect --format '{{.Size}}' ${{ steps.v2_vertica_image.outputs.value }} | numfmt --to=iec)**" >> $GITHUB_STEP_SUMMARY
echo "Image ID: **$(docker inspect --format '{{.ID}}' ${{ steps.v2_vertica_image.outputs.value }})**" >> $GITHUB_STEP_SUMMARY
echo "Digest: **$(IFS=":" read image tag <<< $(echo ${{ steps.v2_vertica_image.outputs.value }} | sed -e 's/^docker.io\///'); docker inspect --format='{{.RepoDigests}}' $image:$tag | sed 's:^.\(.*\).$:\1:' | tr " " "\n" | grep $image | cut -d'@' -f2 || echo "<none>")**" >> $GITHUB_STEP_SUMMARY
echo "Size: **$(docker inspect --format '{{.Size}}' ${{ steps.legacy_vertica_image.outputs.value }} | numfmt --to=iec)**" >> $GITHUB_STEP_SUMMARY
echo "Image ID: **$(docker inspect --format '{{.ID}}' ${{ steps.legacy_vertica_image.outputs.value }})**" >> $GITHUB_STEP_SUMMARY
echo "Digest: **$(IFS=":" read image tag <<< $(echo ${{ steps.legacy_vertica_image.outputs.value }} | sed -e 's/^docker.io\///'); docker inspect --format='{{.RepoDigests}}' $image:$tag | sed 's:^.\(.*\).$:\1:' | tr " " "\n" | grep $image | cut -d'@' -f2 || echo "<none>")**" >> $GITHUB_STEP_SUMMARY
echo -n "Vertica Version: **" >> $GITHUB_STEP_SUMMARY
echo -n $(docker inspect --format '{{index .Config.Labels "vertica-version"}}' ${{ steps.v2_vertica_image.outputs.value }}) >> $GITHUB_STEP_SUMMARY
echo -n $(docker inspect --format '{{index .Config.Labels "vertica-version"}}' ${{ steps.legacy_vertica_image.outputs.value }}) >> $GITHUB_STEP_SUMMARY
echo "**" >> $GITHUB_STEP_SUMMARY

build-server-minimal:
runs-on: ubuntu-latest
outputs:
chinhtranvan marked this conversation as resolved.
Show resolved Hide resolved
image: ${{ steps.minimal_vertica_image.outputs.value }}
steps:

- name: set lower case owner name
env:
OWNER: '${{ github.repository_owner }}'
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}

- name: Pick the name of the image
uses: spilchen/switch-case-action@v2
id: minimal_vertica_image
with:
default: ghcr.io/${{ env.OWNER_LC }}/vertica-k8s:${{ github.sha }}-minimal
default: docker.io/vertica/vertica-k8s-private:latest-minimal-master
conditionals-with-values: |
${{ inputs.minimal_vertica_image != '' }} => ${{ inputs.minimal_vertica_image }}
${{ github.event_name == 'pull_request' }} => vertica-k8s:kind-minimal

- name: Login to GitHub Container registry for non-PRs
uses: docker/login-action@v2
chinhtranvan marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ github.event_name != 'pull_request' && inputs.minimal_vertica_image == '' || startsWith(inputs.minimal_vertica_image, 'ghcr.io') }}
if: ${{ github.event_name != 'pull_request' && startsWith(inputs.minimal_vertica_image, 'ghcr.io') }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -383,27 +279,17 @@ jobs:
uses: ./.github/actions/download-rpm
if: ${{ inputs.minimal_vertica_image == '' }}

- name: Build and optionally push minimal server image
- name: Build the minimal server image
if: ${{ inputs.minimal_vertica_image == '' }}
run: |
export VERTICA_IMG=${{ steps.minimal_vertica_image.outputs.value }}
# We never push the image we build here because the RPM we use is too
# old. The RPM needs to be from at least a 23.3.0 server. So, we build
# here only to test the creation of the image. We don't verify this
# image in the remaining CI. Pick a dummy image name so as not to
# overwrite the output build image that the e2e tests will use.
export VERTICA_IMG=vertica-k8s:kind-minimal
export MINIMAL_VERTICA_IMG=yes
make docker-build-vertica
if [ $GITHUB_EVENT_NAME != 'pull_request' ]
then
make docker-push-vertica
fi

- name: Save the image for consumption by dependent jobs (PRs only)
if: ${{ github.event_name == 'pull_request' }}
run: |
docker save ${{ steps.minimal_vertica_image.outputs.value }} > minimal-vertica-image.tar

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: minimal-vertica-image
path: minimal-vertica-image.tar
make docker-build-vertica-v2

- name: Do a local pull of the image if we didn't create it
if: ${{ inputs.minimal_vertica_image != '' }}
Expand Down
Loading
Loading