Skip to content

Commit

Permalink
support pushing new kotsadm bundle format
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh committed Jan 26, 2024
1 parent 9c593d1 commit 71edbb3
Show file tree
Hide file tree
Showing 11 changed files with 4,142 additions and 4,243 deletions.
7,949 changes: 3,955 additions & 3,994 deletions .github/workflows/build-test.yaml

Large diffs are not rendered by default.

25 changes: 19 additions & 6 deletions .github/workflows/regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,32 +95,38 @@ jobs:
token: ${{ secrets.E2E_GH_PAT }}
path: automation
ref: main

- name: Download kots binary
uses: actions/download-artifact@v4
with:
name: kots
path: ./automation/jumpbox/bin
- name: Download kotsadm release

- name: Download kotsadm bundle
uses: actions/download-artifact@v4
with:
name: kotsadm-release
path: ./automation/jumpbox/docker-archive
- name: Make kotsadm airgap archive with minio image
working-directory: automation/jumpbox
run: tar czf ./kotsadm.tar.gz -C ./ ./docker-archive
name: kotsadm-bundle
path: ./automation/jumpbox/kotsadm-bundle

- name: Make kotsadm airgap archive
working-directory: automation/jumpbox/kotsadm-bundle
run: tar -czf ../kotsadm.tar.gz *

- name: Initialize terraform
if: always()
working-directory: automation/jumpbox
run: |
terraform init
terraform workspace new "$WORKSPACE" || true
terraform workspace select "$WORKSPACE"
- name: Create Jumpbox Environment
if: always()
working-directory: automation/jumpbox
run: |
export TF_VAR_expires_on="${{ needs.get-workspace-expiration.outputs.expiration }}"
terraform apply --auto-approve
- name: Notify Slack
if: failure() && github.ref_name == 'main'
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -228,17 +234,20 @@ jobs:
token: ${{ secrets.E2E_GH_PAT }}
path: automation
ref: main

- name: Initialize terraform
if: always()
working-directory: automation/cluster
run: |
terraform init -backend-config ${{ matrix.test.backend_config }}
terraform workspace new "$WORKSPACE" || true
terraform workspace select "$WORKSPACE"
- name: Destroy test environment before re-run
if: always() && github.run_attempt > 1
working-directory: automation/cluster
run: ./${{ matrix.test.terraform_script }} destroy

- name: Create test environment
if: always()
working-directory: automation/cluster
Expand All @@ -256,6 +265,7 @@ jobs:
export TF_VAR_testim_branch="master"
export TF_VAR_expires_on="${{ needs.get-workspace-expiration.outputs.expiration }}"
./${{ matrix.test.terraform_script }} apply
- name: Wait for instance to be ready
working-directory: automation/cluster
run: |
Expand All @@ -265,12 +275,14 @@ jobs:
do
echo "waiting for instance to become ready" && sleep 1
done
- name: Run the test
working-directory: automation/cluster
run: |
terraform output -raw jumpbox_private_key > ssh.pem
chmod 600 ssh.pem
ssh -i ssh.pem "ubuntu@$(terraform output -raw jumpbox_public_ip)" -oStrictHostKeyChecking=no -oServerAliveInterval=60 -oServerAliveCountMax=10 "ssh -tt ubuntu@$(terraform output -raw control_plane_private_ip) -oServerAliveInterval=60 -oServerAliveCountMax=10 -oConnectionAttempts=30 \"sudo /tmp/start.sh\""
- name: Notify Slack
if: always() && github.ref_name == 'main'
uses: 8398a7/action-slack@v3
Expand All @@ -287,6 +299,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.KOTS_BUILD_STATUS_SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}

cleanup:
needs: [get-workspace-name, tests]
runs-on: ubuntu-20.04
Expand Down
79 changes: 51 additions & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,30 +179,45 @@ jobs:
registry-username: ${{ secrets.DOCKERHUB_USER }}
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}

build-release:
build-kotsadm-bundle:
runs-on: ubuntu-20.04
needs: [generate-tag, build-migrations, build-kotsadm]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Read image tags from env file
uses: falti/dotenv-action@v1
id: dotenv
with:
path: .image.env
- name: Run bundle registry
run: |
mkdir -p kotsadm-bundle/images
mkdir -p kotsadm-bundle-nominio/images
docker run -d -p 5000:5000 --restart=always --name registry -v "$(pwd)/kotsadm-bundle/images":/var/lib/registry registry:2
docker run -d -p 5001:5000 --restart=always --name registry-nominio -v "$(pwd)/kotsadm-bundle-nominio/images":/var/lib/registry registry:2
- name: Build kotsadm bundle
env:
BUNDLE_DIR: kotsadm-bundle
BUNDLE_REGISTRY: localhost:5000
GIT_TAG: ${{ needs.generate-tag.outputs.tag }}
run: mapfile -t envs < <(grep -v '#.*' < .image.env) && export "${envs[@]}" && make kotsadm-bundle

- name: Build tagged release
- name: Build kotsadm bundle without minio
env:
BUNDLE_DIR: kotsadm-bundle-nominio
BUNDLE_REGISTRY: localhost:5001
GIT_TAG: ${{ needs.generate-tag.outputs.tag }}
DOCKER_CONFIG: ./.docker
run: mapfile -t envs < <(grep -v '#.*' < .image.env) && export "${envs[@]}" && make build-release
run: mapfile -t envs < <(grep -v '#.*' < .image.env) && export "${envs[@]}" && make kotsadm-bundle-nominio

- name: Upload kotsadm release
- name: Upload kotsadm bundle
uses: actions/upload-artifact@v4
with:
name: kotsadm-release
path: ./bin/docker-archive
name: kotsadm-bundle
path: kotsadm-bundle

- name: Upload kotsadm bundle without minio
uses: actions/upload-artifact@v4
with:
name: kotsadm-bundle-nominio
path: kotsadm-bundle-nominio

goreleaser:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -264,7 +279,7 @@ jobs:

generate-kurl-addon:
runs-on: ubuntu-20.04
needs: [ generate-tag, build-kurl-proxy, build-kots, build-release ]
needs: [ generate-tag, build-kurl-proxy, build-kots, build-kotsadm-bundle ]
outputs:
addon_package_url: ${{ steps.addon-generate.outputs.addon_package_url }}
env:
Expand Down Expand Up @@ -373,27 +388,35 @@ jobs:
build-airgap:
runs-on: ubuntu-20.04
if: github.ref_type != 'branch'
needs: [goreleaser, generate-tag, build-release]
needs: [goreleaser, generate-tag, build-kotsadm-bundle]
steps:
- name: Download kotsadm release
- name: Download kotsadm bundle
uses: actions/download-artifact@v4
with:
name: kotsadm-release
path: ./docker-archive
- name: Make kotsadm airgap archive with minio image
run: |
tar czf ./kotsadm.tar.gz -C ./ ./docker-archive
- name: Upload airgap bundle with minio image
name: kotsadm-bundle
path: kotsadm-bundle

- name: Download kotsadm bundle without minio
uses: actions/download-artifact@v4
with:
name: kotsadm-bundle-nominio
path: kotsadm-bundle-nominio

- name: Make kotsadm airgap archive
working-directory: kotsadm-bundle
run: tar -czvf ../kotsadm.tar.gz *

- name: Make kotsadm airgap archive without minio
working-directory: kotsadm-bundle-nominio
run: tar -czvf ../kotsadm-nominio.tar.gz *

- name: Upload airgap archive
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.generate-tag.outputs.tag }}
files: ./kotsadm.tar.gz
- name: Make kotsadm airgap archive without minio image
run: |
rm -rf ./docker-archive/minio
rm -f ./kotsadm.tar.gz
tar czf ./kotsadm-nominio.tar.gz -C ./ ./docker-archive
- name: Upload airgap bundle without minio image

- name: Upload airgap archive without minio
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.generate-tag.outputs.tag }}
Expand Down Expand Up @@ -426,7 +449,7 @@ jobs:
regression-test:
if: github.ref_type == 'branch'
needs: [ regression-test-setup, generate-tag, build-kots, generate-kurl-addon, build-release ]
needs: [ regression-test-setup, generate-tag, build-kots, generate-kurl-addon, build-kotsadm-bundle ]
uses: ./.github/workflows/regression.yaml
with:
version_tag_old: ${{ needs.regression-test-setup.outputs.last_release_tag }}
Expand Down
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ all-ttl.sh: build-ttl.sh

.PHONY: kotsadm-bundle
kotsadm-bundle:
# skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm:${GIT_TAG}
# skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm-migrations:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm-migrations:${GIT_TAG}
skopeo copy --all --dest-tls-verify=false docker://ttl.sh/automated-7670109381/kotsadm:24h docker://${BUNDLE_REGISTRY}/kotsadm:v1.107.0
skopeo copy --all --dest-tls-verify=false docker://ttl.sh/automated-7670109381/kotsadm-migrations:24h docker://${BUNDLE_REGISTRY}/kotsadm-migrations:v1.107.0
skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm:${GIT_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm-migrations:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm-migrations:${GIT_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/dex:${DEX_TAG} docker://${BUNDLE_REGISTRY}/dex:${DEX_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/minio:${MINIO_TAG} docker://${BUNDLE_REGISTRY}/minio:${MINIO_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/rqlite:${RQLITE_TAG} docker://${BUNDLE_REGISTRY}/rqlite:${RQLITE_TAG}
Expand All @@ -141,10 +139,8 @@ kotsadm-bundle:

.PHONY: kotsadm-bundle-nominio
kotsadm-bundle-nominio:
# skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm:${GIT_TAG}
# skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm-migrations:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm-migrations:${GIT_TAG}
skopeo copy --all --dest-tls-verify=false docker://ttl.sh/automated-7670109381/kotsadm:24h docker://${BUNDLE_REGISTRY}/kotsadm:v1.107.0
skopeo copy --all --dest-tls-verify=false docker://ttl.sh/automated-7670109381/kotsadm-migrations:24h docker://${BUNDLE_REGISTRY}/kotsadm-migrations:v1.107.0
skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm:${GIT_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/kotsadm-migrations:${GIT_TAG} docker://${BUNDLE_REGISTRY}/kotsadm-migrations:${GIT_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/dex:${DEX_TAG} docker://${BUNDLE_REGISTRY}/dex:${DEX_TAG}
skopeo copy --all --dest-tls-verify=false docker://kotsadm/rqlite:${RQLITE_TAG} docker://${BUNDLE_REGISTRY}/rqlite:${RQLITE_TAG}
skopeo copy --all --dest-tls-verify=false docker://replicated/local-volume-provider:${LVP_TAG} docker://${BUNDLE_REGISTRY}/local-volume-provider:${LVP_TAG}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kots/cli/admin-console-push-images.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func AdminPushImagesCmd() *cobra.Command {
}

if _, err := os.Stat(imageSource); err == nil {
err = image.PushImages(imageSource, *options)
err = image.TagAndPushImagesFromBundle(imageSource, *options)
if err != nil {
return errors.Wrap(err, "failed to push images")
}
Expand Down
Loading

0 comments on commit 71edbb3

Please sign in to comment.