Skip to content

Commit

Permalink
Merge pull request #962 from Rei1010/adjustAdmission
Browse files Browse the repository at this point in the history
Build admission image during schedule CI
  • Loading branch information
ErikJiang authored Sep 18, 2023
2 parents 781b598 + abf9c15 commit 1f2d9e4
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 277 deletions.
91 changes: 91 additions & 0 deletions .github/actions/build-push-for-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build and Push e2e images

on:
workflow_call:

jobs:
build-push-for-e2e:
needs: [ unit-test,get_ref ]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY}| awk -F "/" '{print $1}')
echo "REPO=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Echo env
run: |
echo "REPO: ${{ env.REPO }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ needs.get_ref.outputs.ref }}

- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: kubean-operator Build image
run: docker build . --file ./build/images/$KUKEAN_OPERATOR_IMAGE_NAME/Dockerfile --tag $KUKEAN_OPERATOR_IMAGE_NAME

- name: kubean-operator Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUKEAN_OPERATOR_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUKEAN_OPERATOR_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: kubean-admission Build image
run: docker build . --file ./build/images/$KUBEAN_ADMISSION_IMAGE_NAME/Dockerfile --tag $KUBEAN_ADMISSION_IMAGE_NAME

- name: kubean-admission Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUBEAN_ADMISSION_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUBEAN_ADMISSION_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: spray-job Build image
run: docker build . --file ./build/images/$SPRAY_JOB_IMAGE_NAME/Dockerfile --tag $SPRAY_JOB_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG

- name: spray-job Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$SPRAY_JOB_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SPRAY_JOB_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: airgap-patch Build image
run: docker build . --file ./build/images/$AIRGAP_PATCH_IMAGE_NAME/Dockerfile --tag $AIRGAP_PATCH_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG

- name: airgap-patch Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$AIRGAP_PATCH_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $AIRGAP_PATCH_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
49 changes: 1 addition & 48 deletions .github/workflows/auto-kubean-compatibility-schedule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,55 +19,8 @@ env:

jobs:
build-push-for-e2e:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
uses: kubean-io/kubean/.github/actions/build-push-for-e2e.yml@main

steps:
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY}| awk -F "/" '{print $1}')
echo "REPO=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Echo env
run: |
echo "REPO: ${{ env.REPO }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: kubean-operator Build image
run: docker build . --file ./build/images/$KUKEAN_OPERATOR_IMAGE_NAME/Dockerfile --tag $KUKEAN_OPERATOR_IMAGE_NAME

- name: kubean-operator Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUKEAN_OPERATOR_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUKEAN_OPERATOR_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: spray-job Build image
run: docker build . --file ./build/images/$SPRAY_JOB_IMAGE_NAME/Dockerfile --tag $SPRAY_JOB_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG

- name: spray-job Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$SPRAY_JOB_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SPRAY_JOB_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
auto-kubean-compatibility:
runs-on: [self-hosted, online]
permissions:
Expand Down
84 changes: 1 addition & 83 deletions .github/workflows/auto-pr-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,89 +83,7 @@ jobs:
build-push-for-e2e:
needs: [ unit-test,get_ref ]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY}| awk -F "/" '{print $1}')
echo "REPO=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Echo env
run: |
echo "REPO: ${{ env.REPO }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ needs.get_ref.outputs.ref }}

- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: kubean-operator Build image
run: docker build . --file ./build/images/$KUKEAN_OPERATOR_IMAGE_NAME/Dockerfile --tag $KUKEAN_OPERATOR_IMAGE_NAME

- name: kubean-operator Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUKEAN_OPERATOR_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUKEAN_OPERATOR_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: kubean-admission Build image
run: docker build . --file ./build/images/$KUBEAN_ADMISSION_IMAGE_NAME/Dockerfile --tag $KUBEAN_ADMISSION_IMAGE_NAME

- name: kubean-admission Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUBEAN_ADMISSION_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUBEAN_ADMISSION_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: spray-job Build image
run: docker build . --file ./build/images/$SPRAY_JOB_IMAGE_NAME/Dockerfile --tag $SPRAY_JOB_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG

- name: spray-job Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$SPRAY_JOB_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SPRAY_JOB_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: airgap-patch Build image
run: docker build . --file ./build/images/$AIRGAP_PATCH_IMAGE_NAME/Dockerfile --tag $AIRGAP_PATCH_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG

- name: airgap-patch Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$AIRGAP_PATCH_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $AIRGAP_PATCH_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
uses: kubean-io/kubean/.github/actions/build-push-for-e2e.yml@main

e2e:
needs: [ build-push-for-e2e,get_ref ]
Expand Down
52 changes: 1 addition & 51 deletions .github/workflows/e2e_schedule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,7 @@ env:

jobs:
build-push-for-e2e:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY}| awk -F "/" '{print $1}')
echo "REPO=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Echo env
run: |
echo "REPO: ${{ env.REPO }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: kubean-operator Build image
run: docker build . --file ./build/images/$KUKEAN_OPERATOR_IMAGE_NAME/Dockerfile --tag $KUKEAN_OPERATOR_IMAGE_NAME

- name: kubean-operator Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUKEAN_OPERATOR_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUKEAN_OPERATOR_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: spray-job Build image
run: docker build . --file ./build/images/$SPRAY_JOB_IMAGE_NAME/Dockerfile --tag $SPRAY_JOB_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG

- name: spray-job Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$SPRAY_JOB_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SPRAY_JOB_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
uses: kubean-io/kubean/.github/actions/build-push-for-e2e.yml@main

schedule_sonobouy_e2e:
needs: build-push-for-e2e
Expand Down
45 changes: 1 addition & 44 deletions .github/workflows/kubean_e2e_test_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,7 @@ env:

jobs:
build-push-for-e2e:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY}| awk -F "/" '{print $1}')
echo "REPO=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Echo env
run: |
echo "REPO: ${{ env.REPO }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: kubean-operator Build image
run: docker build . --file ./build/images/$KUKEAN_OPERATOR_IMAGE_NAME/Dockerfile --tag $KUKEAN_OPERATOR_IMAGE_NAME
- name: kubean-operator Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$KUKEAN_OPERATOR_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $KUKEAN_OPERATOR_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: spray-job Build image
run: docker build . --file ./build/images/$SPRAY_JOB_IMAGE_NAME/Dockerfile --tag $SPRAY_JOB_IMAGE_NAME --build-arg SPRAY_TAG=$KUBESPRAY_TAG
- name: spray-job Push image
run: |
IMAGE_ID=ghcr.io/${{ env.REPO }}/$SPRAY_JOB_IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION="$(git describe --tags --abbrev=8 --dirty)-e2e"
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SPRAY_JOB_IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
uses: kubean-io/kubean/.github/actions/build-push-for-e2e.yml@main

get_helm_version:
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 1f2d9e4

Please sign in to comment.