Skip to content

Commit

Permalink
Files merged into script
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhanasand committed Feb 10, 2025
1 parent d841928 commit c292d7e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
4 changes: 0 additions & 4 deletions tests/ansible/ansible.cfg

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ansible/inventory.ini

This file was deleted.

33 changes: 32 additions & 1 deletion tests/ansible/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,36 @@ if [[ -z "$JFROG_EMAIL" || -z "$JFROG_TOKEN" || -z "$JFROG_ID" ]]; then
exit 1
fi

cat > ansible.cfg <<EOL
[galaxy]
server_list = artifactory_collections
[galaxy_server.artifactory_collections]
url = https://{{ jfrog_id }}.jfrog.io/artifactory/api/ansible/collections/
EOL

cat > inventory.ini <<EOL
[localhost]
127.0.0.1 ansible_connection=local
EOL

cat > test_proxy.yml <<EOL
---
- name: Test Artifactory Proxy
hosts: localhost
tasks:
- name: Download a file via Artifactory proxy
ansible.builtin.get_url:
url: "https://{{ JFROG_EMAIL }}:{{ JFROG_TOKEN }}@{{ JFROG_ID }}.jfrog.io/artifactory/github/eirikhanasand/lsm/blob/main/README.md"
dest: ./README.md
EOL

# Runs the playbook with proxy settings
ansible-playbook -i inventory.ini test_proxy.yml -e "JFROG_ID=$JFROG_ID" -e "JFROG_EMAIL=$JFROG_EMAIL" -e "JFROG_TOKEN=$JFROG_TOKEN"
ansible-playbook -i inventory.ini test_proxy.yml -e "JFROG_ID=$JFROG_ID" -e "JFROG_EMAIL=$JFROG_EMAIL" -e "JFROG_TOKEN=$JFROG_TOKEN" 2>&1 | tee ansible.log || {
if grep -q "409" ansible.log; then
echo "409 success"
else
exit 1
fi
}

rm inventory.ini ansible.cfg ansible.log test_proxy.yml
8 changes: 0 additions & 8 deletions tests/ansible/test_proxy.yml

This file was deleted.

0 comments on commit c292d7e

Please sign in to comment.