Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: introduce Ansible CI #585

Merged
merged 132 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
6b3d984
chore(release): 2.20.0
semantic-release-bot Sep 24, 2024
046d655
ci: disable galaxy release for testing
alperenkose Sep 25, 2024
bad2a96
ci: ansible ee image
alperenkose Sep 25, 2024
e2742b3
ci: ee default working dir
alperenkose Sep 25, 2024
b9834c0
ci: ee discover python locally
alperenkose Sep 25, 2024
eb56c7d
ci: ee fix pyversion output
alperenkose Sep 25, 2024
976e1c4
ci: docker context
alperenkose Sep 25, 2024
fc2abe4
ci: ansible build context
alperenkose Sep 25, 2024
53e2057
ci: docker image ref tag
alperenkose Sep 25, 2024
fe7984d
ci: docker set context
alperenkose Sep 25, 2024
bc5a9ee
ci: ee yml bash escape PYCMD
alperenkose Sep 25, 2024
d788000
ci: ee fix requirements format and debugging
alperenkose Sep 25, 2024
4051618
ci: ee debugging build requirements.txt
alperenkose Sep 25, 2024
334b1ae
ci: ee debugging build requirements.txt
alperenkose Sep 25, 2024
495fe3d
ci: ee prepend builder copy requirements.txt
alperenkose Sep 25, 2024
db7f91e
ci: ee run on push to develop
alperenkose Sep 25, 2024
b13d364
chore: commit to trigger EE
alperenkose Sep 25, 2024
6a5d760
ci: release image build job
alperenkose Sep 25, 2024
bb35233
ci: debug workflow_run gh event
alperenkose Sep 25, 2024
e6a7af0
ci: debug workflow_run gh event
alperenkose Sep 25, 2024
40a3922
ci: ee disable provenance
alperenkose Sep 25, 2024
97c31ba
feat: ee ci for development
alperenkose Sep 25, 2024
4fcfb4a
Merge branch 'develop'
alperenkose Sep 25, 2024
c3d2498
chore(release): 2.20.0
semantic-release-bot Sep 25, 2024
0542e56
feat: test ee ci for release
alperenkose Sep 25, 2024
a7605af
feat: test ee ci for release
alperenkose Sep 25, 2024
1caaec0
chore(release): 2.20.0
semantic-release-bot Sep 25, 2024
beb3fca
Merge branch 'main' into develop
alperenkose Sep 25, 2024
d79a97b
fix: temp disable sanity tests
alperenkose Sep 25, 2024
aa86c1d
chore(release): 2.23.0
semantic-release-bot Sep 25, 2024
9c92e00
fix: debug release image
alperenkose Sep 25, 2024
6871fc3
fix: check release job for release build
alperenkose Sep 26, 2024
60c8324
fix: remove debug
alperenkose Sep 26, 2024
14db5fd
chore(release): 2.23.1
semantic-release-bot Sep 26, 2024
cb10ef9
fix: work dir
alperenkose Sep 26, 2024
5503279
feat: new ee ci
alperenkose Sep 26, 2024
18f0103
fix: new ee ci
alperenkose Sep 26, 2024
9b3d9e4
feat: refactor ee ci
alperenkose Sep 26, 2024
a6459cb
fix: refactor ee ci
alperenkose Sep 26, 2024
fee0c4b
fix: refactor ee ci
alperenkose Sep 26, 2024
20c6b97
fix: refactor ee ci
alperenkose Sep 26, 2024
760462e
fix: refactor ee ci
alperenkose Sep 26, 2024
5f7d68f
fix: merge docker meta
alperenkose Sep 26, 2024
24d17ea
fix: trick semantic
alperenkose Sep 26, 2024
4a01120
fix: trick semantic
alperenkose Sep 26, 2024
0436ce5
fix: trick semantic
alperenkose Sep 26, 2024
d11007d
fix: trick semantic
alperenkose Sep 26, 2024
fd3232d
fix: trick semantic
alperenkose Sep 26, 2024
d4894a5
fix: trick semantic
alperenkose Sep 26, 2024
30e6a1f
fix: trick semantic
alperenkose Sep 26, 2024
7fe91d0
fix: trick semantic
alperenkose Sep 26, 2024
4959ed4
fix: trick semantic
alperenkose Sep 26, 2024
e3f4400
fix: trick semantic
alperenkose Sep 26, 2024
119e872
fix: trick semantic
alperenkose Sep 26, 2024
0cf6feb
fix: trick semantic
alperenkose Sep 26, 2024
dc88640
fix: trick semantic
alperenkose Sep 26, 2024
533acc3
fix: trick semantic
alperenkose Sep 26, 2024
ee52c05
fix: trick semantic
alperenkose Sep 26, 2024
c84f733
fix: trick semantic
alperenkose Sep 26, 2024
518419f
fix: trick semantic
alperenkose Sep 26, 2024
0907bcc
fix: trick semantic
alperenkose Sep 26, 2024
02c438a
fix: work dir
alperenkose Sep 26, 2024
039b0f0
feat: new ee ci
alperenkose Sep 26, 2024
750f65e
fix: new ee ci
alperenkose Sep 26, 2024
3916283
feat: refactor ee ci
alperenkose Sep 26, 2024
69bd778
fix: refactor ee ci
alperenkose Sep 26, 2024
c8c20df
fix: refactor ee ci
alperenkose Sep 26, 2024
4967797
fix: refactor ee ci
alperenkose Sep 26, 2024
46b5404
fix: refactor ee ci
alperenkose Sep 26, 2024
f1cf7ef
fix: merge docker meta
alperenkose Sep 26, 2024
30c8232
fix: trick semantic
alperenkose Sep 26, 2024
11c06d2
fix: trick semantic
alperenkose Sep 26, 2024
2bd67aa
fix: trick semantic
alperenkose Sep 26, 2024
47d3cea
fix: trick semantic
alperenkose Sep 26, 2024
9db37ba
fix: trick semantic
alperenkose Sep 26, 2024
8623a7a
fix: trick semantic
alperenkose Sep 26, 2024
b2df5ec
fix: trick semantic
alperenkose Sep 26, 2024
d221ce7
fix: trick semantic
alperenkose Sep 26, 2024
68b0f0b
fix: trick semantic
alperenkose Sep 26, 2024
5fd4dce
fix: trick semantic
alperenkose Sep 26, 2024
5ffab61
fix: trick semantic
alperenkose Sep 26, 2024
47f372f
fix: trick semantic
alperenkose Sep 26, 2024
cec5bdb
fix: trick semantic
alperenkose Sep 26, 2024
4eb1d97
fix: trick semantic
alperenkose Sep 26, 2024
27a5fe0
fix: trick semantic
alperenkose Sep 26, 2024
ced4e06
fix: trick semantic
alperenkose Sep 26, 2024
2b77ad1
fix: trick semantic
alperenkose Sep 26, 2024
0490c30
fix: trick semantic
alperenkose Sep 26, 2024
d45e27e
chore(release): 2.24.0
semantic-release-bot Sep 26, 2024
acd2256
fix: trick semantic
alperenkose Sep 26, 2024
718cf32
Merge branch 'develop'
alperenkose Sep 26, 2024
230a702
chore(release): 2.25.0
semantic-release-bot Sep 26, 2024
e9a55f3
fix: refactor ee ci
alperenkose Sep 27, 2024
c7e1faf
fix: refactor ee ci
alperenkose Sep 27, 2024
4f4edd9
fix: refactor ee ci
alperenkose Sep 27, 2024
b2fe985
fix: refactor ee ci
alperenkose Sep 27, 2024
41bbaf8
Merge branch 'develop'
alperenkose Sep 27, 2024
b84f88c
chore(release): 2.25.1
semantic-release-bot Sep 27, 2024
5979ebf
fix: refactor ee ci
alperenkose Sep 27, 2024
5d472f4
chore(release): 2.25.2
semantic-release-bot Sep 27, 2024
2422242
fix: event name
alperenkose Sep 27, 2024
e0dc943
fix: ci
alperenkose Sep 27, 2024
9d809fe
fix: event name
alperenkose Sep 27, 2024
f3d5fa5
fix: ci
alperenkose Sep 27, 2024
7fbabe8
chore(release): 2.25.3
semantic-release-bot Sep 27, 2024
144e81d
fix: git context
alperenkose Sep 27, 2024
bb36138
fix: without work-dir
alperenkose Sep 28, 2024
069c0c4
Merge branch 'develop'
alperenkose Sep 28, 2024
698b283
chore(release): 2.25.4
semantic-release-bot Sep 28, 2024
63f2f66
fix: override panos for testing
alperenkose Sep 28, 2024
a17ed51
fix: test without providing panos collection
alperenkose Sep 28, 2024
9d7d2a2
fix: test without python requirements
alperenkose Sep 28, 2024
fa46174
fix: test without python requirements
alperenkose Sep 28, 2024
6a5d2a3
chore(release): 2.25.5
semantic-release-bot Sep 28, 2024
14fe047
fix: test without python requirements
alperenkose Sep 28, 2024
63a5b56
chore(release): 2.25.6
semantic-release-bot Sep 28, 2024
ebcfbe2
ci: no dev release
alperenkose Sep 28, 2024
00ddd77
fix: test ansible collection path
alperenkose Sep 28, 2024
a2807a3
fix: test pr
alperenkose Sep 28, 2024
1b0fb54
Merge pull request #1 from alperenkose/test-pr-ee
alperenkose Sep 28, 2024
ff2a7b6
fix: update comments
alperenkose Sep 28, 2024
e9b5a23
fix: test with defaults
alperenkose Sep 28, 2024
9c2749f
chore(release): 2.25.7
semantic-release-bot Sep 28, 2024
9edcb41
ci: revert testing changes to merge to main repo
alperenkose Sep 28, 2024
6358813
ci: revert testing changes to merge to main repo
alperenkose Sep 28, 2024
6c5b9e8
ci: revert testing changes to merge to main repo
alperenkose Sep 28, 2024
cb21254
feat: use pyversion
alperenkose Oct 2, 2024
649aa44
fix: use pyversion
alperenkose Oct 2, 2024
d558d26
fix: use pyversion
alperenkose Oct 2, 2024
2287ec9
fix: use env vars
alperenkose Oct 2, 2024
2537c10
chore(release): 2.26.0
semantic-release-bot Oct 2, 2024
17c78ab
Merge branch 'develop' into ansible-ee-ci
alperenkose Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/do-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

ansible-galaxy collection build
ansible-galaxy collection publish paloaltonetworks-panos-* --server release_galaxy
ansible-galaxy collection publish paloaltonetworks-panos-* --server automation_hub
ansible-galaxy collection publish paloaltonetworks-panos-* --server automation_hub
28 changes: 28 additions & 0 deletions .github/workflows/_discover_python_ver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: (sub) Discover Python version

defaults:
run:
shell: bash

permissions:
contents: read

on:
workflow_call:
outputs:
pyversion:
description: A discovered Python version
value: ${{ jobs.pyversion.outputs.pyversion }}

jobs:
pyversion:
name: Discover minimum Python version
runs-on: ubuntu-latest
outputs:
pyversion: ${{ steps.pyversion.outputs.pyversion }}
steps:
- name: checkout code
uses: actions/checkout@v4
- name: discover Python version
id: pyversion
uses: PaloAltoNetworks/pan-os-upgrade-assurance/.github/actions/discover_python_version@v0.3.1
103 changes: 95 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
NAMESPACE: paloaltonetworks
COLLECTION_NAME: panos
PYTHON_VERSION: 3.8

jobs:

Expand Down Expand Up @@ -109,9 +108,14 @@ jobs:
cd .github/workflows
python -m tox -- ../..

pyversion:
name: Discover minimum Python version
uses: ./.github/workflows/_discover_python_ver.yml

format:
name: Code Format Check
runs-on: ubuntu-latest
needs: pyversion
defaults:
run:
working-directory: ./ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
Expand All @@ -123,7 +127,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ needs.pyversion.outputs.pyversion }}

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
Expand All @@ -139,6 +143,10 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [sanity, tox, lint, format]
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.release.outputs.new_release_published }}
new_release_version: ${{ steps.release.outputs.new_release_version }}
new_release_git_tag: ${{ steps.release.outputs.new_release_git_tag }}

steps:
- name: Checkout
Expand Down Expand Up @@ -192,12 +200,12 @@ jobs:
docs:
name: docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [release]
needs: [release, pyversion]
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./ansible_collections/paloaltonetworks/panos
working-directory: ./ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}

steps:
# Just a note here: The Ansible stuff is apparently doing realpath
Expand All @@ -207,12 +215,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
path: ./ansible_collections/paloaltonetworks/panos
path: ./ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ needs.pyversion.outputs.pyversion }}

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
Expand Down Expand Up @@ -247,8 +255,8 @@ jobs:
run: |
cd ../../../..
mv pan-os-ansible the_repo
mv the_repo/ansible_collections/paloaltonetworks/panos pan-os-ansible
mkdir -p pan-os-ansible/ansible_collections/paloaltonetworks/panos
mv the_repo/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} pan-os-ansible
mkdir -p pan-os-ansible/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.4.3
Expand All @@ -257,3 +265,82 @@ jobs:
branch: gh-pages
folder: docs/html
clean: true

rc:
name: Check rc EE
runs-on: ubuntu-latest
needs: [sanity, tox, lint, format]
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop')
outputs:
rc: ${{ steps.rc.outputs.new_release_published }}
new_release_version: ${{ steps.rc.outputs.new_release_version }}

steps:
- name: checkout code
uses: actions/checkout@v4

- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: install dependencies
run: |
npm install --save-dev semantic-release
npm install @semantic-release/commit-analyzer -D
npm install conventional-changelog-conventionalcommits -D
npm install @semantic-release/changelog -D
npm install @semantic-release/git -D
npm install @semantic-release/exec -D
# npx semantic-release
# npm ci

- name: trick semantic check
id: rc
run: |
# Trick semantic-release into thinking we're not in a CI environment
OUTPUT="$(bash -c "unset GITHUB_ACTIONS && unset GITHUB_EVENT_NAME && npx semantic-release --dry-run --no-ci --branches '${GITHUB_REF#refs/heads/}'")"
# print output
echo "$OUTPUT"
# grep with semver regex - \K means to start matching from here in Perl regex
NEW_RELEASE_VERSION=$(echo "$OUTPUT" | grep -oP 'The next release version is \K(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?' || echo -n "")
echo "new_release_version=$NEW_RELEASE_VERSION" >> "$GITHUB_OUTPUT"

if [ -z "$NEW_RELEASE_VERSION" ]; then
echo "new_release_published=false" >> "$GITHUB_OUTPUT"
else
echo "new_release_published=true" >> "$GITHUB_OUTPUT"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF: ${{ github.ref }}

# below does NOT work because semantic-release expects branch name in the config even in dry-run
# but we run rc check in non main branches
# - name: rc check
# id: rc
# uses: cycjimmy/semantic-release-action@v4
# with:
# dry_run: true
# semantic_version: 17.1.1
# extra_plugins: |
# conventional-changelog-conventionalcommits@^4.4.0
# @semantic-release/changelog@^5.0.1
# @semantic-release/git@^9.0.0
# @semantic-release/exec@^5.0.00
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_dev_ee:
name: dev_ee
needs: rc
if: needs.rc.outputs.rc == 'true'
uses: ./.github/workflows/ee.yml

build_prod_ee:
name: release_ee
needs: release
uses: ./.github/workflows/ee.yml
with:
release: true
release_tag: ${{ needs.release.outputs.new_release_git_tag }}
Loading
Loading