Skip to content

Commit

Permalink
feat(CI): Adds Travis CI support
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhav Thali <[email protected]>

Adds travis suffix and removes workflows handled on GA

use upstream gh secret names

Change-Id: I34f9126cfe29d2d318f17b37699ade668a02815e
Signed-off-by: nickboldt <[email protected]>

add secrets and let travis CI autoformat script

Change-Id: I622dccb74aa08558e4be715889cc24e25f6b4104
Signed-off-by: nickboldt <[email protected]>

add license headers to new .travis.yml and *.sh scripts

Change-Id: Ibac061ec2adcac0df1feb39618423da0378260ae
Signed-off-by: nickboldt <[email protected]>

no-op change to trigger GH workflow using new TRAVIS_TOKEN

Change-Id: Ife082c3c4da8e32bae444cc64c2efe206c445e9b
Signed-off-by: nickboldt <[email protected]>

Revert "no-op change to trigger GH workflow using new TRAVIS_TOKEN"

This reverts commit 052ba3c.

Revert "Revert "no-op change to trigger GH workflow using new TRAVIS_TOKEN""

This reverts commit 0d7feec.

Revert "Revert "Revert "no-op change to trigger GH workflow using new TRAVIS_TOKEN"""

This reverts commit 83bd477.
  • Loading branch information
prabhav-thali authored and nickboldt committed Aug 17, 2021
1 parent 4dd4695 commit afd1f85
Show file tree
Hide file tree
Showing 6 changed files with 276 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/gh_actions_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,28 @@ jobs:
platforms: linux/amd64,linux/ppc64le,linux/arm64
push: false
tags: quay.io/eclipse/che-machine-exec:pr-check

travis-build:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Trigger build on Travis CI
run: |
body="{
\"request\":{
\"config\": {
\"env\": {
\"global\": [
\"PR_NUMBER=${{ github.event.pull_request.number }}\"
]
}
}
}}"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ secrets.TRAVIS_TOKEN }}" \
-d "$body" \
https://api.travis-ci.com/repo/eclipse-che%2Fche-machine-exec/requests
19 changes: 19 additions & 0 deletions .github/workflows/next-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ jobs:
tags: |
quay.io/eclipse/che-machine-exec:next
quay.io/eclipse/che-machine-exec:${{ steps.vars.outputs.sha_short }}
travis-build:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Trigger build on Travis CI
run: |
body="{
\"request\":{
\"branch\":\"main\"
}}"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ secrets.TRAVIS_TOKEN }}" \
-d "$body" \
https://api.travis-ci.com/repo/eclipse-che%2Fche-machine-exec/requests
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,28 @@ jobs:
MATTERMOST_CHANNEL: eclipse-che-releases
MATTERMOST_USERNAME: che-bot

travis-build:
needs: build
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Trigger build on Travis CI
run: |
body="{
\"request\":{
\"config\": {
\"env\": {
\"global\": [
\"TAG=${{ github.event.inputs.version }}\"
]
}
}
}}"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${{ secrets.TRAVIS_TOKEN }}" \
-d "$body" \
https://api.travis-ci.com/repo/eclipse-che%2Fche-machine-exec/requests
157 changes: 157 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

language: go
go:
- '1.15'
os: linux
dist: focal
git:
depth: false
env:
global:
- TAG=next
- TRAVIS_TAG=travis
- REGISTRY=quay.io
- ORGANIZATION=eclipse
- IMAGE=che-machine-exec
- PR_NUMBER=
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zVR1h+Rfr18/pBFt3WuSa9ghcm1qf/b1SlwzrxWsPajI0rcYctpUmSOGAMDGdQt5hrKWmHfG8uMyNB31cBO/HGyuaaVIV3UFLmKjBX2F2/G8E9xj6jXORQg/1KMQBcCd/Z6LhOAYHTAYeNdzZrS8VDYAJwhoUOpMLyqELcZi9719Pf5XsmXWD2Z3BZP20=
install:
- export SHORT_SHA=$(git rev-parse --short HEAD)
- export GITHUB_TOKEN="$CHE_BOT_GITHUB_TOKEN"
- echo "$RH_CHE_AUTOMATION_DOCKERHUB_PASSWORD" | docker login -u "$RH_CHE_AUTOMATION_DOCKERHUB_USERNAME"
--password-stdin
- echo "$QUAY_ECLIPSE_CHE_PASSWORD" | docker login quay.io -u "$QUAY_ECLIPSE_CHE_USERNAME
" --password-stdin
jobs:
fast_finish: true
allow_failures:
- if: env(PR_NUMBER) IS present
arch: arm64
- if: env(PR_NUMBER) IS present
arch: ppc64le
- if: env(PR_NUMBER) IS present
arch: s390x
include:
- stage: PR Check
if: env(PR_NUMBER) IS present
name: Check docker build on amd64
arch: amd64
install: &1
- git fetch origin +refs/pull/${PR_NUMBER}/merge
- git checkout -qf FETCH_HEAD
script: docker build -f build/dockerfiles/Dockerfile -t "${REGISTRY}/${ORGANIZATION}/${IMAGE}:pr-check-${TRAVIS_CPU_ARCH}"
.
- stage: PR Check
if: env(PR_NUMBER) IS present
name: Check docker build on arm64
arch: arm64
install: *1
script: docker build -f build/dockerfiles/Dockerfile -t "${REGISTRY}/${ORGANIZATION}/${IMAGE}:pr-check-${TRAVIS_CPU_ARCH}"
.
- stage: PR Check
if: env(PR_NUMBER) IS present
name: Check docker build on ppc64le
arch: ppc64le
install: *1
script: docker build -f build/dockerfiles/Dockerfile -t "${REGISTRY}/${ORGANIZATION}/${IMAGE}:pr-check-${TRAVIS_CPU_ARCH}"
.
- stage: PR Check
if: env(PR_NUMBER) IS present
name: check docker build PR on s390x
arch: s390x
install: *1
script: docker build -f build/dockerfiles/Dockerfile -t "${REGISTRY}/${ORGANIZATION}/${IMAGE}:pr-check-${TRAVIS_CPU_ARCH}"
.
- if: env(PR_NUMBER) IS present
name: Run unit tests on amd64
arch: amd64
install: &2
- git fetch origin +refs/pull/${PR_NUMBER}/merge
- git checkout -qf FETCH_HEAD
- export GO111MODULE="on"
- go get ${gobuild_args} ./...
script: &3
- |
CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags '-w -s' -a -installsuffix cgo -o che-machine-exec .
export CHE_WORKSPACE_ID=test_id
go test ./... -test.v
- if: env(PR_NUMBER) IS present
name: Run unit tests on arm64
arch: arm64
install: *2
script: *3
- if: env(PR_NUMBER) IS present
name: Run unit tests on ppc64le
arch: ppc64le
install: *2
script: *3
- if: env(PR_NUMBER) IS present
name: Run unit tests on s390x
arch: s390x
install: *2
script: *3
- stage: Build and push both short SHA tag and next tag
if: type = api AND branch = main AND env(TAG) = "next"
name: Build image on amd64
arch: amd64
script: &4
- bash .travis/build_image.sh
- stage: Build and push both short SHA tag and next tag
if: type = api AND branch = main AND env(TAG) = "next"
name: Build image on arm64
arch: arm64
script: *4
- stage: Build and push both short SHA tag and next tag
if: type = api AND branch = main AND env(TAG) = "next"
name: Build image on ppc64le
arch: ppc64le
script: *4
- stage: Build and push both short SHA tag and next tag
if: type = api AND branch = main AND env(TAG) = "next"
name: Build image on s390x
arch: s390x
script: *4
- stage: Publish multiarch image with next & short_sha tag
if: type = api AND branch = main AND env(TAG) = "next"
script: bash .travis/publish_multiarch.sh
- stage: Release che-machine-exec
if: type = api AND env(TAG) IS present AND env(TAG) != "next"
name: Build image on amd64
arch: amd64
script: &5
- |
BRANCH=${TAG%.*}.x
git checkout "${BRANCH}"
bash .travis/build_image.sh
- stage: Release che-machine-exec
if: type = api AND env(TAG) IS present AND env(TAG) != "next"
name: Build image on arm64
arch: arm64
script: *5
- stage: Release che-machine-exec
if: type = api AND env(TAG) IS present AND env(TAG) != "next"
name: Build image on ppc64le
arch: ppc64le
script: *5
- stage: Release che-machine-exec
if: type = api AND env(TAG) IS present AND env(TAG) != "next"
name: Build image on s390x
arch: s390x
script: *5
- stage: Publish multiarch image with release tag
if: type = api AND env(TAG) IS present AND env(TAG) != "next"
script: bash .travis/publish_multiarch.sh
22 changes: 22 additions & 0 deletions .travis/build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
set -e

# Build images
docker build -f build/dockerfiles/Dockerfile -t "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-${TRAVIS_CPU_ARCH}" .
docker push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-${TRAVIS_CPU_ARCH}"

# Tag image with short_sha in case of next build
if [[ "$TAG" == "next" ]]; then
docker tag "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-${TRAVIS_CPU_ARCH}" "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${SHORT_SHA}-${TRAVIS_TAG}-${TRAVIS_CPU_ARCH}"
docker push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${SHORT_SHA}-${TRAVIS_TAG}-${TRAVIS_CPU_ARCH}"
fi
28 changes: 28 additions & 0 deletions .travis/publish_multiarch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
set -e

# Create amend with images built on individual architectures
AMEND=""
AMEND+=" --amend ${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-amd64";
AMEND+=" --amend ${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-arm64";
AMEND+=" --amend ${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-ppc64le";
AMEND+=" --amend ${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}-s390x";

# Create manifest and push multiarch image
docker manifest create "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}" $AMEND
docker manifest push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${TAG}-${TRAVIS_TAG}"

if [[ "$TAG" == "next" ]]; then
docker manifest create "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${SHORT_SHA}-${TRAVIS_TAG}" $AMEND
docker manifest push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${SHORT_SHA}-${TRAVIS_TAG}"
fi

0 comments on commit afd1f85

Please sign in to comment.