chore: upgrade actions/upload-artifact to v4, the v1 is deprecated an… #1246
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
# Copyright 2018 The original authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Integration Tests | |
env: | |
MAVEN_ARGS: -B -e | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
cache: | |
name: Cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m")" | |
shell: bash | |
- name: Cache .m2 registry | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Install artifacts | |
run: ./mvnw -f pom.xml ${MAVEN_ARGS} -DskipTests clean install | |
kubernetes: | |
name: Kubernetes Build | |
needs: cache | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
kubernetes: [v1.22.2] | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m")" | |
shell: bash | |
- name: Cache .m2 registry | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Setup Minikube-Kubernetes | |
uses: manusa/[email protected] | |
with: | |
minikube version: v1.23.2 | |
kubernetes version: ${{ matrix.kubernetes }} | |
github token: ${{ secrets.GITHUB_TOKEN }} | |
driver: 'docker' | |
start args: '--force' | |
- name: Setup Java 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Install the Service Binding Operator | |
run: | | |
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.18.3/install.sh | bash -s v0.18.3 | |
kubectl create -f https://operatorhub.io/install/service-binding-operator.yaml | |
until [[ "Succeeded" == `kubectl get csv -n operators | grep service-binding-operator | awk -F' ' '{print $7}'` ]]; do echo "Waiting for SBO"; sleep 5; done | |
kubectl get csv -n operators | grep service-binding-operator | awk -F" " '{print $7}' | |
- name: Install Knative | |
run: | | |
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.2.0/serving-crds.yaml | |
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.2.0/serving-core.yaml | |
- name: Install and Run Integration Tests | |
run: | | |
eval $(minikube docker-env) | |
./mvnw -B clean install -Presources -Pwith-examples -Pwith-tests -Pwith-service-binding-examples -Pwith-knative-examples -Pwith-kubernetes-specific-examples -Duser.name=noregistry -Dformat.skip=true -Dkubernetes.image-pull-policy=IfNotPresent | |
- name: Zip Artifacts | |
if: failure() | |
run: | | |
zip -R manifests-k8s-jvm${{ matrix.java }}.zip 'classes/META-INF/dekorate/*' | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: ci-manifests | |
path: manifests-k8s-jvm${{ matrix.java }}.zip | |
openshift: | |
name: Openshift Build | |
needs: cache | |
# the action "manusa/[email protected]" only works in ubuntu-20.04 | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
openshift: [v3.11.0] | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m")" | |
shell: bash | |
- name: Cache .m2 registry | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Setup OpenShift | |
uses: manusa/[email protected] | |
with: | |
oc version: ${{ matrix.openshift }} | |
github token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Java 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Integration Tests | |
run: | | |
oc login -u admin -p admin | |
oc new-project itests | |
oc import-image fabric8/s2i-java:2.3 --from=docker.io/fabric8/s2i-java:2.3 --confirm | |
oc tag --source docker docker.io/fabric8/s2i-java:2.3 s2i-java:2.3 | |
./mvnw -B clean install -Presources -Pwith-examples -Pwith-tests -Pwith-openshift-specific-examples -Duser.name=dekorateio -Dformat.skip=true | |
- name: Zip Artifacts | |
if: failure() | |
run: | | |
zip -R manifests-ocp-jvm${{ matrix.java }}.zip 'classes/META-INF/dekorate/*' | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: ci-manifests | |
path: manifests-ocp-jvm${{ matrix.java }}.zip | |
tekton: | |
name: Tekton Build | |
needs: cache | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
tekton: [ v0.47.0 ] | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m")" | |
shell: bash | |
- name: Cache .m2 registry | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ steps.get-date.outputs.date }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Kubernetes KinD Cluster | |
uses: container-tools/kind-action@v1 | |
with: | |
version: v0.18.0 | |
registry: true | |
- name: Setup Java 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Install Tekton | |
run: | | |
kubectl apply -f https://github.com/tektoncd/pipeline/releases/download/${{ matrix.tekton }}/release.yaml || true | |
- name: Build | |
run: | | |
./mvnw -B clean install -Dformat.skip=true -DskipTests | |
- name: Run Tekton Integration Tests using TaskRun | |
run: | | |
kubectl create namespace tekton | |
kubectl config set-context --current --namespace=tekton | |
cd examples/spring-boot-with-tekton-example | |
# Build example | |
mvn clean install -DskipTests -Ddekorate.docker.registry=$KIND_REGISTRY -Ddekorate.tekton.imageRegistryInsecure=true -Ddekorate.tekton.projectBuilderArguments=clean,install,-Pwith-examples,-DskipTests,-Dformat.skip=true,-pl,examples/spring-boot-with-tekton-example,-am | |
cat target/classes/META-INF/dekorate/tekton-task.yml | |
# Install Tekton Task manifests | |
kubectl apply -f target/classes/META-INF/dekorate/tekton-task.yml | |
# Trigger Task workflow | |
kubectl apply -f target/classes/META-INF/dekorate/tekton-task-run.yml | |
# Wait to finish | |
kubectl wait --for=condition=Succeeded --timeout=800s TaskRun/spring-boot-with-tekton-example-run-now | |
kubectl wait deployment spring-boot-with-tekton-example --for condition=Available=True --timeout=180s | |
# Verify application | |
RESULT=$(kubectl exec $(kubectl get pod -l app.kubernetes.io/name=spring-boot-with-tekton-example -o name) -- wget -qO- http://localhost:9090) | |
if [[ "$RESULT" = *"Hello world"* ]] | |
then | |
exit 0 | |
fi | |
echo "Application is not working. Result was: $RESULT" | |
exit 1 | |
- name: Print logs at failures | |
if: failure() | |
run: | | |
kubectl config set-context --current --namespace=tekton | |
echo "kubectl get pods: " | |
kubectl get pods | |
echo "kubectl describe TaskRun/spring-boot-with-tekton-example-run-now: " | |
kubectl describe TaskRun/spring-boot-with-tekton-example-run-now | |
echo "kubectl logs spring-boot-with-tekton-example-run-now-pod --all-containers --max-log-requests 10: " | |
kubectl logs spring-boot-with-tekton-example-run-now-pod --all-containers --max-log-requests 10 | |
- name: Run Tekton Integration Tests using PipelineRun | |
run: | | |
kubectl create namespace tektonpipeline | |
kubectl config set-context --current --namespace=tektonpipeline | |
cd examples/spring-boot-with-tekton-example | |
# Build example | |
mvn clean install -DskipTests -Ddekorate.docker.registry=$KIND_REGISTRY -Ddekorate.tekton.imageRegistryInsecure=true -Ddekorate.tekton.projectBuilderArguments=clean,install,-Pwith-examples,-DskipTests,-Dformat.skip=true,-pl,examples/spring-boot-with-tekton-example,-am | |
cat target/classes/META-INF/dekorate/tekton-pipeline.yml | |
# Install Tekton Pipeline manifests | |
kubectl apply -f target/classes/META-INF/dekorate/tekton-pipeline.yml | |
# Trigger Task workflow | |
kubectl apply -f target/classes/META-INF/dekorate/tekton-pipeline-run.yml | |
# Wait to finish | |
kubectl wait --for=condition=Succeeded --timeout=800s PipelineRun/spring-boot-with-tekton-example-run-now | |
kubectl wait deployment spring-boot-with-tekton-example --for condition=Available=True --timeout=180s | |
# Verify application | |
RESULT=$(kubectl exec $(kubectl get pod -l app.kubernetes.io/name=spring-boot-with-tekton-example -o name) -- wget -qO- http://localhost:9090) | |
if [[ "$RESULT" = *"Hello world"* ]] | |
then | |
exit 0 | |
fi | |
echo "Application is not working. Result was: $RESULT" | |
exit 1 | |
- name: Print logs at failures | |
if: failure() | |
run: | | |
kubectl config set-context --current --namespace=tektonpipeline | |
echo "kubectl get pods: " | |
kubectl get pods | |
echo "kubectl describe PipelineRun/spring-boot-with-tekton-example-run-now: " | |
kubectl describe PipelineRun/spring-boot-with-tekton-example-run-now | |
echo "kubectl logs spring-boot-with-tekton-example-run-now-git-clone-pod: " | |
kubectl logs spring-boot-with-tekton-example-run-now-git-clone-pod | |
echo "kubectl logs spring-boot-with-tekton-example-run-now-project-build-pod: " | |
kubectl logs spring-boot-with-tekton-example-run-now-project-build-pod | |
echo "kubectl logs spring-boot-with-tekton-example-run-now-image-build-pod: " | |
kubectl logs spring-boot-with-tekton-example-run-now-image-build-pod | |
echo "kubectl logs spring-boot-with-tekton-example-run-now-deploy-pod: " | |
kubectl logs spring-boot-with-tekton-example-run-now-deploy-pod | |
- name: Zip Artifacts | |
if: failure() | |
run: | | |
zip -R manifests-tekton-jvm${{ matrix.java }}.zip 'classes/META-INF/dekorate/*' | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: ci-manifests | |
path: manifests-tekton-jvm${{ matrix.java }}.zip |