-
Notifications
You must be signed in to change notification settings - Fork 175
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
1 parent
a0a50b5
commit ca2fc96
Showing
5 changed files
with
212 additions
and
64 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -42,3 +42,4 @@ megalinter-reports/ | |
/jq | ||
/portalauth | ||
.kiota.log | ||
podmanlog |
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 |
---|---|---|
|
@@ -20,60 +20,177 @@ pr: | |
exclude: | ||
- docs/* | ||
|
||
variables: | ||
- template: vars.yml | ||
|
||
resources: | ||
containers: | ||
- container: golang | ||
image: registry.access.redhat.com/ubi8/go-toolset:1.21.11-1.1720406008 | ||
options: --user=0 | ||
- container: python | ||
image: registry.access.redhat.com/ubi8/python-39:latest | ||
options: --user=0 | ||
- container: ubi8 | ||
image: registry.access.redhat.com/ubi8/toolbox:8.8 | ||
options: --user=0 --privileged -v /dev/shm:/dev/shm --device /dev/net/tun --name vpn | ||
|
||
variables: | ||
- template: vars.yml | ||
|
||
stages: | ||
- stage: NEW_HOTNESS | ||
- stage: NotContainerized | ||
dependsOn: Containerized | ||
jobs: | ||
- job: Build_Lint_Test_RP_And_Portal | ||
- job: Python_Unit_Tests | ||
pool: | ||
name: 1es-aro-ci-pool | ||
variables: | ||
HOME: $(Agent.BuildDirectory) | ||
|
||
steps: | ||
- template: ./templates/template-checkout.yml | ||
- script: | | ||
set -xe | ||
export NO_CACHE=true | ||
make ci-rp | ||
make test-python | ||
[[ -z "$(git status -s)" ]] | ||
displayName: 🧪Run Python Unit Tests | ||
target: python | ||
- job: Build_and_Test_Az_ARO_Extension | ||
- job: Golang_Unit_Tests | ||
pool: | ||
name: 1es-aro-ci-pool | ||
variables: | ||
GOCACHE: /tmp/gocache | ||
steps: | ||
- template: ./templates/template-checkout.yml | ||
|
||
- script: | | ||
set -xe | ||
go version | ||
go env | ||
displayName: Print Go version & env | ||
target: golang | ||
- script: | | ||
set -xe | ||
make generate | ||
[[ -z "$(git status -s)" ]] | ||
displayName: ⚙️ Run Golang code generate | ||
target: golang | ||
- script: | | ||
set -xe | ||
make build-all | ||
[[ -z "$(git status -s)" ]] | ||
displayName: 🕵️ Build Golang code | ||
target: golang | ||
- script: | | ||
set -xe | ||
make unit-test-go | ||
displayName: 🧪 Run Golang unit tests | ||
target: golang | ||
- task: PublishTestResults@2 | ||
displayName: 📊 Publish tests results | ||
inputs: | ||
testResultsFiles: $(System.DefaultWorkingDirectory)/**/report.xml | ||
condition: succeededOrFailed() | ||
|
||
- script: | | ||
set -xe | ||
go run github.com/axw/gocov/[email protected] convert cover.out | go run github.com/AlekSi/[email protected] > coverage.xml | ||
displayName: ⚙️ Process Reports | ||
condition: succeededOrFailed() | ||
target: golang | ||
- task: PublishCodeCoverageResults@1 | ||
displayName: 📈 Publish code coverage | ||
inputs: | ||
codeCoverageTool: Cobertura | ||
summaryFileLocation: $(System.DefaultWorkingDirectory)/**/coverage.xml | ||
failIfCoverageEmpty: false | ||
condition: succeededOrFailed() | ||
target: golang | ||
|
||
- job: Lint_Admin_Portal | ||
pool: | ||
name: 1es-aro-ci-pool | ||
steps: | ||
- template: ./templates/template-checkout.yml | ||
- script: | | ||
set -xe | ||
make lint-admin-portal | ||
displayName: 🧹 Lint Admin Portal | ||
- stage: Containerized | ||
dependsOn: [] | ||
jobs: | ||
- job: Build_Lint_Test_RP_And_Portal | ||
pool: | ||
name: 1es-aro-ci-pool | ||
steps: | ||
- template: ./templates/template-checkout.yml | ||
- script: | | ||
set -xe | ||
export NO_CACHE=true | ||
make azext-aro | ||
- job: Lint_Az_ARO_Extension | ||
# Install podman | ||
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm | ||
sudo dnf install -y podman make | ||
which podman | ||
podman --version | ||
whoami | ||
# Start podman service | ||
. ./hack/e2e/utils.sh | ||
run_podman | ||
validate_podman_running | ||
# run build | ||
export PODMAN_REMOTE_ARGS="-r --url=tcp://localhost:8888" | ||
make ci-rp | ||
# Stop podman | ||
kill_podman | ||
target: ubi8 | ||
- job: Build_and_Test_Az_ARO_Extension | ||
pool: | ||
name: 1es-aro-ci-pool | ||
steps: | ||
- template: ./templates/template-checkout.yml | ||
- script: | | ||
set -xe | ||
make test-python | ||
export NO_CACHE=true | ||
- stage: Golang_Code_Generation | ||
jobs: | ||
- job: Run_Golang_Code_Generate | ||
displayName: "⚙️ Run Golang code generate" | ||
# Install podman | ||
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm | ||
sudo dnf install -y podman make | ||
which podman | ||
podman --version | ||
whoami | ||
# Start podman service | ||
. ./hack/e2e/utils.sh | ||
run_podman | ||
validate_podman_running | ||
# run build | ||
export PODMAN_REMOTE_ARGS="-r --url=tcp://localhost:8888" | ||
make azext-aro | ||
# Stop podman | ||
kill_podman | ||
target: ubi8 | ||
- job: Lint_Az_ARO_Extension | ||
pool: | ||
name: 1es-aro-ci-pool | ||
container: golang | ||
variables: | ||
GOCACHE: /tmp/gocache # Set the Go build cache to a writable directory | ||
HOME: $(Agent.BuildDirectory) | ||
steps: | ||
- template: ./templates/template-checkout.yml | ||
- script: | | ||
set -xe | ||
make generate | ||
export AZDEV_CONFIG_DIR=$(Agent.BuildDirectory)/azdev-config | ||
make test-python | ||
[[ -z "$(git status -s)" ]] | ||
displayName: "Run Golang Code Generate" | ||
target: python |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash -e | ||
|
||
run_podman() { | ||
echo "########## 🚀 Run Podman in background ##########" | ||
podman --log-level=debug system service --time=0 tcp://127.0.0.1:8888 > podmanlog 2>&1 & | ||
PODMAN_PID=$! | ||
echo "Podman PID: $PODMAN_PID" | ||
} | ||
|
||
validate_podman_running() { | ||
echo "########## ?Checking podman Status ##########" | ||
ELAPSED=0 | ||
while true; do | ||
sleep 5 | ||
http_code=$(curl -k -s -o /dev/null -w '%{http_code}' http://localhost:8888/v1.30/_ping || true) | ||
case $http_code in | ||
"200") | ||
echo "########## ✅ Podman Running ##########" | ||
break | ||
;; | ||
*) | ||
echo "Attempt $ELAPSED - podman is NOT up. Code : $http_code, waiting" | ||
sleep 2 | ||
# after 40 secs return exit 1 to not block ci | ||
ELAPSED=$((ELAPSED + 1)) | ||
if [ $ELAPSED -eq 20 ]; then | ||
echo "########## ❌ Podman failed to start within timeout ##########" | ||
kill_podman | ||
exit 1 | ||
fi | ||
;; | ||
esac | ||
done | ||
} | ||
|
||
kill_podman() { | ||
echo "podman logs:" | ||
cat podmanlog | ||
echo "########## Kill the podman running in background ##########" | ||
|
||
if [ -n "$PODMAN_PID" ]; then | ||
kill $PODMAN_PID 2>/dev/null | ||
wait $PODMAN_PID 2>/dev/null || echo "Podman process $PODMAN_PID was not a child of this shell." | ||
else | ||
echo "No PODMAN_PID found. Attempting to kill by port." | ||
rppid=$(lsof -t -i :8888) | ||
if [ -n "$rppid" ]; then | ||
kill $rppid | ||
echo "Killed podman running on port 8888 with PID $rppid." | ||
else | ||
echo "No process found running on port 8888." | ||
fi | ||
fi | ||
} |