diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 000000000..e56e50368 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,53 @@ +name: Build and Push dev MCAD image into Quay + +on: + push: + branches: + - '*' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set latest tag and Branch name + run: | + BRANCH=$(echo ${GITHUB_REF#refs/heads/}) + echo "GIT_BRANCH=$(echo "$BRANCH" | sed 's/[^A-Za-z0-9._-]/-/g' )" >> $GITHUB_ENV + if [[ "$BRANCH" == "main" ]]; then + echo "TAG=dev" >> $GITHUB_ENV + elif [[ "$BRANCH" == release-* ]]; then + echo "TAG=dev-$BRANCH" >> $GITHUB_ENV + else + LATEST_TAG=$(git describe --abbrev=0 --tags) + echo "TAG=$BRANCH-$LATEST_TAG" >> $GITHUB_ENV + fi + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19.10 + + - name: Build + run: + make mcad-controller + + - name: Run Unit tests + run: make run-test + + - name: Build Image + run: | + make images -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.TAG }} + + - name: Push Image + run: | + make push-images -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.TAG }} quay_repository=quay.io/project-codeflare quay_id=${{ secrets.QUAY_ID }} quay_token=${{ secrets.QUAY_TOKEN }} + + - name: Run E2E tests + run: | + make run-e2e -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.TAG }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7daaa5764..000000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ - -# Skip CI check when running as a pull request -if: "$TRAVIS_PULL_REQUEST != false" - -language: go - -sudo: required - -env: - - HOME=/home/travis - -services: - - docker - -go: - - "1.19.10" - -go_import_path: github.com/project-codeflare/multi-cluster-app-dispatcher - -install: [] - - -before_script: - - export TEST_LOG_LEVEL=2 - -script: - - BLUE='\033[34m' - - make mcad-controller - - make run-test - # Process 'make images' when NOT a pull request - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make images; fi' - # Process 'make push-images' when NOT a pull request - - 'if [[ "$TRAVIS_PULL_REQUEST" == "false" && ! "$TRAVIS_BRANCH" =~ "^v[0-9]\.[0-9]+\.[0-9]+" ]]; then make push-images; fi' - # Run the e2e and handle Travis condition where Travis fails on no output for 10 minutes. No output for 10 minutes - # is fine for our test cases that waits for 10 minutes before requeuing a job. The other workaround was to - # use 'travis_wait n' which unfortunately does not stream output until the very end so monitoring the Travis log - # during runtime is not possible. - - make run-e2e & - - PID=$! && echo -e "${BLUE}make run e2e pid=${PID}" - - while [ -e /proc/${PID} ]; do echo -n "." && sleep 30; done - - wait ${PID} diff --git a/Makefile b/Makefile index e874fae69..b1de384cb 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ CAT_CMD=$(if $(filter $(OS),Windows_NT),type,cat) RELEASE_VER:= CURRENT_DIR=$(shell pwd) GIT_BRANCH:=$(shell git symbolic-ref --short HEAD 2>&1 | grep -v fatal) + #define the GO_BUILD_ARGS if you need to pass additional arguments to the go build GO_BUILD_ARGS?= @@ -22,16 +23,7 @@ CLIENT_GEN ?= $(LOCALBIN)/client-gen LISTER_GEN ?= $(LOCALBIN)/lister-gen INFORMER_GEN ?= $(LOCALBIN)/informer-gen -# Reset branch name if this a Travis CI environment -ifneq ($(strip $(TRAVIS_BRANCH)),) - GIT_BRANCH:=${TRAVIS_BRANCH} -endif - TAG:=$(shell echo "") -# Check for git repository id sent by Travis-CI -ifneq ($(strip $(git_repository_id)),) - TAG:=${TAG}${git_repository_id}- -endif # Check for current branch name and update 'RELEASE_VER' and 'TAG' ifneq ($(strip $(GIT_BRANCH)),) @@ -184,7 +176,6 @@ push-images: verify-tag-name ifeq ($(strip $(quay_repository)),) $(info No registry information provided. To push images to a docker registry please set) $(info environment variables: quay_repository, quay_token, and quay_id. Environment) - $(info variables do not need to be set for github Travis CICD.) else $(info Log into quay) docker login quay.io -u ${quay_id} --password ${quay_token} @@ -193,7 +184,7 @@ else $(info Push the docker image to registry) docker push ${quay_repository}/mcad-controller:${TAG} ifeq ($(strip $(git_repository_id)),main) - $(info Update the `latest` tag when built from `main`) + $(info Update the `dev` tag when built from `main`) docker tag mcad-controller:${TAG} ${quay_repository}/mcad-controller:latest docker push ${quay_repository}/mcad-controller:latest endif diff --git a/hack/run-e2e-kind.sh b/hack/run-e2e-kind.sh index 3028ef7a6..c26b7d13e 100755 --- a/hack/run-e2e-kind.sh +++ b/hack/run-e2e-kind.sh @@ -58,14 +58,13 @@ function update_test_host { fi echo "CPU architecture for downloads is: ${arch}" - #Only run this function if we are running on the travis build machinbe, - if [ "$(lsb_release -c -s 2>&1 | grep xenial)" == "xenial" ]; then - sudo apt-get update && sudo apt-get install -y apt-transport-https curl - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list - sudo apt-get update + which curl >/dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "curl not installed, exiting." + exit 1 fi - + which kubectl >/dev/null 2>&1 if [ $? -ne 0 ] then