-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (122 loc) · 4.81 KB
/
deploy-ee.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
name: EE Build (reusable)
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
EE_FOLDER_NAME:
description: >-
Name of the folder where the EE definition is located
(Will become the name of the EE)
default: ''
required: true
type: string
EE_IMAGE_TAG:
description: >-
Tag name for the image
default: 'latest'
required: true
type: string
QUAY_ORGANIZATION:
description: >-
Name of the Organization in Quay to use when pushing the image
type: string
default: 'branic'
secrets:
QUAY_USERNAME:
description: >-
Name of the quay user to use to push the image
required: true
QUAY_PASSWORD:
description: >-
Password to use for logging into the quay.io container registry
required: true
REDHAT_USERNAME:
description: >-
Username to use for logging into the registry.redhat.io container
registry
required: true
REDHAT_PASSWORD:
description: >-
Password to use for logging into the registry.redhat.io container
registry
required: true
AH_TOKEN:
description: >-
API token to use for Red Hat hosted Automation Hub
required: true
jobs:
build-ee:
runs-on: ubuntu-latest
environment: deploy
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install python requirements
run: pip3 install -r requirements.txt
- name: Login to quay.io
id: registry-quay
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Login to registry.redhat.io
id: registry-redhat
uses: redhat-actions/podman-login@v1
with:
registry: registry.redhat.io
username: ${{ secrets.REDHAT_USERNAME }}
password: ${{ secrets.REDHAT_PASSWORD }}
- name: Build image
id: build-image
working-directory: ${{ inputs.EE_FOLDER_NAME }}
env:
ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN: ${{ secrets.AH_TOKEN }}
run: >-
ansible-builder build
--context=../${{ inputs.EE_FOLDER_NAME }}
--tag=${{ inputs.EE_FOLDER_NAME }}:${{ inputs.EE_IMAGE_TAG }}
--tag=${{ inputs.EE_FOLDER_NAME }}:${{ github.sha }}
--build-arg ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ inputs.EE_FOLDER_NAME }}
tags: |
${{ inputs.EE_IMAGE_TAG }}
${{ github.sha }}
registry: quay.io/${{ inputs.QUAY_ORGANIZATION }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
# yamllint disable rule:line-length
- name: Print summary
working-directory: ${{ inputs.EE_FOLDER_NAME }}
run: |
echo "## :rocket: Usage" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Image pushed to repository: [${{ steps.push-to-quay.outputs.registry-path }}](https://${{ steps.push-to-quay.outputs.registry-path }})" >> $GITHUB_STEP_SUMMARY
echo "> \`podman pull ${{ steps.push-to-quay.outputs.registry-path }}\`" >> $GITHUB_STEP_SUMMARY
echo "> \`podman pull quay.io/${{ inputs.QUAY_ORGANIZATION }}/${{ inputs.EE_FOLDER_NAME }}:${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "## :pushpin: Ansible info:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "`podman run ${{ inputs.EE_FOLDER_NAME }} ansible --version`" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "`podman run ${{ inputs.EE_FOLDER_NAME }} ansible-lint --version`" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "## :pushpin: Installed collections:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "`podman run ${{ inputs.EE_FOLDER_NAME }} ansible-galaxy collection list`" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "## :pushpin: Containerfile:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "`cat Containerfile`" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY