Skip to content

Commit d771b50

Browse files
[JUJU-2401] Added release candidate workflow. (#784)
* Added nightly build action
1 parent 38979d7 commit d771b50

2 files changed

Lines changed: 101 additions & 26 deletions

File tree

.github/workflows/test.yaml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,34 @@ jobs:
6565
with:
6666
provider: lxd
6767
juju-channel: 3.0/stable
68-
- name: Set proxy in controller
69-
run: |
70-
set -euxo pipefail
71-
# build a squid config file
72-
CONTROLLER_IP=$(juju list-controllers --format yaml | yq '.controllers[.current-controller].recent-server' | awk -F '[:]' '{print $1}');
73-
echo "Controller IP is: $CONTROLLER_IP"
74-
PROXY=$CONTROLLER_IP:3128
75-
echo "Proxy address is: $PROXY"
76-
echo "acl all src all" > squid.conf
77-
echo "http_access allow all" >> squid.conf
78-
echo "http_port $PROXY" >> squid.conf
79-
cat squid.conf
80-
# copy to the controller and reconfigure it
81-
juju status -m controller
82-
juju switch controller
83-
juju ssh 0 "sudo apt-get install squid -y"
84-
juju scp squid.conf 0:/tmp/squid.conf
85-
juju ssh 0 "sudo mv /tmp/squid.conf /etc/squid/squid.conf"
86-
juju ssh 0 "sudo squid -k reconfigure"
87-
# Test curl after waiting
88-
sleep 10
89-
echo "Test proxy access"
90-
curl -s -o /dev/null -w "%{http_code}" --proxy http://$PROXY https://charmhub.io
91-
# set model defaults
92-
juju model-defaults apt-http-proxy=$PROXY apt-https-proxy=$PROXY juju-http-proxy=$PROXY juju-https-proxy=$PROXY snap-http-proxy=$PROXY snap-https-proxy=$PROXY
93-
juju model-defaults
68+
# 2023-01-11 Commented until we discover a
69+
# clear approach for this.
70+
# - name: Set proxy in controller
71+
# run: |
72+
# set -euxo pipefail
73+
# # build a squid config file
74+
# CONTROLLER_IP=$(juju list-controllers --format yaml | yq '.controllers[.current-controller].recent-server' | awk -F '[:]' '{print $1}');
75+
# echo "Controller IP is: $CONTROLLER_IP"
76+
# PROXY=$CONTROLLER_IP:3128
77+
# echo "Proxy address is: $PROXY"
78+
# echo "acl all src all" > squid.conf
79+
# echo "http_access allow all" >> squid.conf
80+
# echo "http_port $PROXY" >> squid.conf
81+
# cat squid.conf
82+
# # copy to the controller and reconfigure it
83+
# juju status -m controller
84+
# juju switch controller
85+
# juju ssh 0 "sudo apt-get install squid -y"
86+
# juju scp squid.conf 0:/tmp/squid.conf
87+
# juju ssh 0 "sudo mv /tmp/squid.conf /etc/squid/squid.conf"
88+
# juju ssh 0 "sudo squid -k reconfigure"
89+
# # Test curl after waiting
90+
# sleep 10
91+
# echo "Test proxy access"
92+
# curl -s -o /dev/null -w "%{http_code}" --proxy http://$PROXY https://charmhub.io
93+
# # set model defaults
94+
# juju model-defaults apt-http-proxy=$PROXY apt-https-proxy=$PROXY juju-http-proxy=$PROXY juju-https-proxy=$PROXY snap-http-proxy=$PROXY snap-https-proxy=$PROXY
95+
# juju model-defaults
9496
- name: Setup Python
9597
uses: actions/setup-python@v4
9698
with:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Nightly release candidate testing
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # Run at 12AM UTC, every day
6+
7+
jobs:
8+
candidate-integration:
9+
name: Candidate integration
10+
timeout-minutes: 120
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python:
15+
- "3.8"
16+
- "3.9"
17+
- "3.10"
18+
steps:
19+
- name: Download artifact from previous workflow
20+
id: download_artifact
21+
uses: dawidd6/action-download-artifact@v2
22+
with:
23+
workflow_conclusion: success
24+
name: juju-last-candidate-version
25+
if_no_artifact_found: ignore
26+
- name: Check if there is a new candidate
27+
shell: bash
28+
run: |
29+
candidate=$(snap info juju | grep 3.0/candidate | awk '{print $2}')
30+
last_tested=NA
31+
if [ -f juju-last-candidate-version ]; then
32+
last_tested=$(cat juju-last-candidate-version)
33+
fi
34+
next_test=NA
35+
if [[ "$candidate" == "^" ]]; then
36+
echo "No candidate to test"
37+
else
38+
if [[ "$candidate" == "$last_tested" ]]; then
39+
echo "Candidate $candidate was already tested"
40+
else
41+
echo "Candidate $candidate has to be tested"
42+
next_test="$candidate"
43+
fi
44+
fi
45+
echo "next-test=$next_test" >> $GITHUB_ENV
46+
echo "$next_test" > ~/juju-last-candidate-version
47+
- name: Check out code
48+
uses: actions/checkout@v3
49+
if: ${{ env.next-test != 'NA' }}
50+
- name: Setup operator environment
51+
if: ${{ env.next-test != 'NA' }}
52+
uses: charmed-kubernetes/actions-operator@main
53+
with:
54+
provider: lxd
55+
juju-channel: 3.0/candidate
56+
- name: Setup Python
57+
if: ${{ env.next-test != 'NA' }}
58+
uses: actions/setup-python@v4
59+
with:
60+
python-version: ${{ matrix.python }}
61+
- name: Install dependencies
62+
if: ${{ env.next-test != 'NA' }}
63+
run: pip install tox
64+
- name: Run integration
65+
if: ${{ env.next-test != 'NA' }}
66+
# Force one single concurrent test
67+
run: tox -e integration -- -n 1
68+
- name: Upload artifact
69+
if: ${{ env.next-test != 'NA' }}
70+
uses: actions/upload-artifact@v3
71+
with:
72+
name: juju-last-candidate-version
73+
path: ~/juju-last-candidate-version

0 commit comments

Comments
 (0)