File tree Expand file tree Collapse file tree 6 files changed +135
-1
lines changed
src/ansible_creator/resources/execution_env_project
fixtures/project/ee_project Expand file tree Collapse file tree 6 files changed +135
-1
lines changed Original file line number Diff line number Diff line change 1
- ## This is a sample execution environment project to build and publish your EE.
1
+ # Execution Environment Project
2
+
3
+ ### This is a sample execution environment project to build and publish your EE.
4
+
5
+ ## Included content/ Directory Structure
6
+
7
+ The directory structure follows best practices recommended by the Ansible community. Feel free to customize this template according to your specific project requirements.
8
+
9
+ ```
10
+ ├── .github
11
+ │ └── workflows
12
+ │ └── ci.yml
13
+ ├── .gitignore
14
+ ├── README.md
15
+ └── execution-environment.yml
16
+ ```
Original file line number Diff line number Diff line change
1
+ # Combine workflow for pull-request, push-to-main and release events.
2
+
3
+ name : Execution environment build
4
+
5
+ on :
6
+ pull_request_target :
7
+ branches :
8
+ - main
9
+ types : [opened, reopened, synchronize]
10
+ push :
11
+ branches :
12
+ - main
13
+ release :
14
+ types : [published]
15
+
16
+ jobs :
17
+ ee-build :
18
+ uses : ansible/ansible-content-actions/.github/workflows/ee-build.yml@main
19
+ with :
20
+ registry : ghcr.io
21
+ secrets :
22
+ registry_username : ${{ github.actor }}
23
+ registry_password : ${{ secrets.GITHUB_TOKEN }}
24
+ # Only needed if base image of execution-environment.yml file is from Red Hat (ee-minimal)
25
+ # registry_redhat_username: ${{ secrets.registry_redhat_username }}
26
+ # registry_redhat_password: ${{ secrets.registry_redhat_password }}
Original file line number Diff line number Diff line change
1
+ context /
2
+ .DS_Store
Original file line number Diff line number Diff line change
1
+ # Execution Environment Project
2
+
3
+ ### This is a sample execution environment project to build and publish your EE.
4
+
5
+ ## Included content/ Directory Structure
6
+
7
+ The directory structure follows best practices recommended by the Ansible community. Feel free to customize this template according to your specific project requirements.
8
+
9
+ ```
10
+ ├── .github
11
+ │ └── workflows
12
+ │ └── ci.yml
13
+ ├── .gitignore
14
+ ├── README.md
15
+ └── execution-environment.yml
16
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ version : 3
3
+
4
+ images :
5
+ base_image :
6
+ name : quay.io/fedora/fedora:41
7
+
8
+ dependencies :
9
+ # Use python3
10
+ python_interpreter :
11
+ package_system : python3
12
+ python_path : /usr/bin/python3
13
+
14
+ ansible_core :
15
+ package_pip : ansible-core
16
+
17
+ ansible_runner :
18
+ package_pip : ansible-runner
19
+
20
+ system :
21
+ - openssh-clients
22
+ - sshpass
23
+
24
+ python :
25
+ - ansible-navigator
26
+ - boto3
27
+ - requests
28
+
29
+ galaxy :
30
+ collections :
31
+ - name : ansible.posix
32
+ - name : ansible.utils
33
+
34
+ additional_build_steps :
35
+ append_base :
36
+ - RUN $PYCMD -m pip install -U pip
37
+
38
+ options :
39
+ tags :
40
+ - ansible_sample_ee
Original file line number Diff line number Diff line change @@ -169,6 +169,41 @@ def mock_unique_name_in_devfile(init: Init) -> str:
169
169
assert re .search (r"Warning: re-initializing existing directory" , result ) is not None , result
170
170
171
171
172
+ def test_run_success_ee_project (
173
+ capsys : pytest .CaptureFixture [str ],
174
+ tmp_path : Path ,
175
+ cli_args : ConfigDict ,
176
+ ) -> None :
177
+ """Test Init.run().
178
+
179
+ Successfully create new ee project
180
+
181
+ Args:
182
+ capsys: Pytest fixture to capture stdout and stderr.
183
+ tmp_path: Temporary directory path.
184
+ cli_args: Dictionary, partial Init class object.
185
+ """
186
+ cli_args ["project" ] = "execution_env"
187
+ cli_args ["init_path" ] = str (tmp_path / "new_project" )
188
+ init = Init (
189
+ Config (** cli_args ),
190
+ )
191
+
192
+ init .run ()
193
+ result = capsys .readouterr ().out
194
+
195
+ # check stdout
196
+ assert re .search (r"Note: execution_env project created" , result ) is not None
197
+
198
+ # recursively assert files created
199
+ cmp = dircmp (
200
+ str (tmp_path / "new_project" ),
201
+ str (FIXTURES_DIR / "project" / "ee_project" ),
202
+ )
203
+ diff = has_differences (dcmp = cmp , errors = [])
204
+ assert diff == [], diff
205
+
206
+
172
207
def test_run_success_ansible_project (
173
208
capsys : pytest .CaptureFixture [str ],
174
209
tmp_path : Path ,
You can’t perform that action at this time.
0 commit comments