This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jinle.xjl
committed
Sep 13, 2023
1 parent
e6eaccb
commit 07f9b16
Showing
4 changed files
with
61 additions
and
59 deletions.
There are no files selected for viewing
114 changes: 58 additions & 56 deletions
114
.github/workflows/module_controller_ci_build_deploy_to_aliyun.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,86 @@ | ||
name: Module Controller Build and Deploy Master to Aliyun | ||
name: Module Controller Integration Test | ||
run-name: ${{ github.actor }} pushed module-controller code | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'module-controller/**' | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- 'module-controller/**' | ||
|
||
# enable manually running the workflow | ||
workflow_dispatch: | ||
|
||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: linux | ||
WORK_DIR: module-controller | ||
TAG: ci-test-master-latest | ||
DOCKERHUB_REGISTRY: serverless-registry.cn-shanghai.cr.aliyuncs.com | ||
MODULE_CONTROLLER_IMAGE_PATH: opensource/test/module-controller | ||
INTEGRATION_TESTS_IMAGE_PATH: opensource/test/module-controller-integration-tests | ||
POD_NAMESPACE: default | ||
|
||
defaults: | ||
run: | ||
working-directory: module-controller | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Minikube | ||
run: | | ||
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | ||
sudo install minikube-linux-amd64 /usr/local/bin/minikube | ||
- name: Start Minikube | ||
run: minikube start | ||
|
||
- name: Prepare development env | ||
run: | | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_moduledeployments.yaml | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_modulereplicasets.yaml | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_modules.yaml | ||
kubectl apply -f config/crd/bases/serverless.alipay.com_moduletemplates.yaml | ||
kubectl apply -f config/rbac/role.yaml | ||
kubectl apply -f config/rbac/role_binding.yaml | ||
kubectl apply -f config/rbac/service_account.yaml | ||
kubectl apply -f config/samples/dynamic-stock-deployment.yaml | ||
kubectl apply -f config/samples/module-deployment-controller.yaml | ||
kubectl apply -f config/samples/dynamic-stock-service.yaml | ||
- run: sleep 5 | ||
|
||
- name: Docker login | ||
uses: docker/login-action@v2.2.0 | ||
with: | ||
registry: ${{ env.DOCKERHUB_REGISTRY }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
logout: false | ||
- name: get pod | ||
run: | | ||
kubectl get pod | ||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: wait base pod available | ||
run: | | ||
kubectl wait --for=condition=available deployment/dynamic-stock-deployment --timeout=30s | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ hashFiles('${{ env.WORK_DIR }}/*Dockerfile') }} | ||
- name: get module controller pod available | ||
run: | | ||
kubectl wait --for=condition=available deployment/module-controller --timeout=30s | ||
- name: Build and push module-controller Docker images | ||
uses: docker/build-push-action@v4.1.1 | ||
with: | ||
context: ${{ env.WORK_DIR }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
file: ${{ env.WORK_DIR }}/Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.MODULE_CONTROLLER_IMAGE_PATH }}:${{ env.TAG }} | ||
- name: Apply moduledeployment | ||
run: | | ||
kubectl apply -f config/samples/module-deployment_v1alpha1_moduledeployment_facade.yaml | ||
- run: sleep 30 | ||
- name: get moduledeployment | ||
run: | | ||
kubectl get moduledeployment | ||
- name: get modulereplicaset | ||
run: | | ||
kubectl get modulereplicaset | ||
- name: Build and push module-controller-integration-tests Docker images | ||
uses: docker/build-push-action@v4.1.1 | ||
with: | ||
context: ${{ env.WORK_DIR }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
file: ${{ env.WORK_DIR }}/IntegrationTestsDockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.INTEGRATION_TESTS_IMAGE_PATH }}:${{ env.TAG }} | ||
- run: sleep 5 | ||
|
||
#- name: kubectl-simple | ||
# uses: steebchen/kubectl@v2.1.1 | ||
# with: | ||
# config: ${{ secrets.CI_KUBE_CONFIG }} | ||
# command: apply -f ${{ env.WORK_DIR }}/config/samples/module-deployment-controller.yaml | ||
- name: get module | ||
run: | | ||
kubectl get module |
This file contains 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
This file contains 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
This file contains 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