{"id":5960434,"name":"weiiwang01/setup-devstack-swift","ecosystem":"actions","description":"Create a openstack swift instance for test purpose","homepage":"","licenses":null,"normalized_licenses":[],"repository_url":"https://github.com/weiiwang01/setup-devstack-swift","keywords_array":["action","platform-engineering"],"namespace":"canonical","versions_count":1,"first_release_published_at":"2023-02-16T02:00:14.000Z","latest_release_published_at":"2023-02-16T02:00:14.000Z","latest_release_number":"v1","last_synced_at":"2026-04-13T23:03:36.589Z","created_at":"2023-01-26T00:49:58.626Z","updated_at":"2026-04-13T23:03:36.590Z","registry_url":"https://github.com/weiiwang01/setup-devstack-swift","install_command":null,"documentation_url":null,"metadata":{"name":"Devstack Swift Test Instance","description":"Create a openstack swift instance for test purpose","inputs":{"network":{"description":"IPv4 network address and network prefix reserved for devstack server in CIDR notation. Network prefix bits must be less than 31 since an additional IPv4 address need to be allocated for the host. Update this option only if the default address conflicts with other Github  actions.\n","required":true,"default":"10.100.115.2/24"},"use-cache":{"description":"Use Github action cache to speed up devstack build time. setup-devstack-swift will use 1 GiB of cache, disable this only if other slower steps require that 1 GiB of  cache. Or the workflow runs are very infrequent, cache will be expired each time  (building from scratch and generating cache is slower than building from scratch alone).\n","required":true,"default":"true"},"s3api":{"description":"Enable swift s3api middleware to emulate the S3 REST api on top of swift. \n","required":true,"default":"false"},"cache-key":{"description":"Cache key for the GitHub action cache used in this action. When set to an empty string, use the default cache key schema to generate one.\n","required":true,"default":""}},"outputs":{"credentials":{"description":"Credentials used to authenticate access to swift test instance. For swift API:\n  It's OpenStack RC file style i.g. export \u003cenv-name\u003e=\u003cenv-value\u003e.\nFor S3 API: \n  It's in ini file format with three keys: aws_access_key_id, aws_secret_access_key and endpoint_url.\n","value":"${{ steps.output-credentials.outputs.credentials }}"}},"runs":{"using":"composite","steps":[{"name":"Allocate network address","id":"parse-network","shell":"python","run":"import ipaddress\nimport itertools\nimport os\n\ninterface = ipaddress.IPv4Interface(\"${{ inputs.network }}\")\naddress = interface.ip\nnetwork = interface.network\nprefix_len = network.prefixlen\nif prefix_len \u003e= 31:\n    raise ValueError(\n        \"Network prefix length greater or equal to 31, can't allocate network address for host\"\n    )\nfor host_address in itertools.islice(network, 1, None):\n    if host_address != address:\n        with open(os.environ['GITHUB_OUTPUT'], \"a\") as file:\n            print(f\"devstack-ip={address}\", file=file)\n            print(f\"host-address={host_address}/{prefix_len}\", file=file)\n        break\n"},{"name":"Setup LXD","shell":"bash","run":"sudo iptables -I DOCKER-USER  -j ACCEPT\nsudo snap install lxd\nsudo snap refresh lxd\nsudo lxd waitready\nsudo lxd init --auto\nsudo lxc project create devstack -c features.images=false\nsudo lxc profile show default | sudo lxc profile edit default --project devstack\nsudo lxc network create lxdbrstack ipv6.address=none ipv4.address=${{ steps.parse-network.outputs.host-address }} ipv4.nat=true --project devstack\nsudo lxc network detach-profile lxdbr0 default eth0 --project devstack\nsudo lxc network attach-profile lxdbrstack default eth0 --project devstack\nsudo chmod a+wr /var/snap/lxd/common/lxd/unix.socket\nbash -c \"sudo usermod -a -G lxd $USER\"\n"},{"name":"LXD Devstack Image Cache","if":"inputs.use-cache == 'true'","id":"devstack-swift-cache","uses":"actions/cache@v3","with":{"path":"${{ github.workspace }}/.devstack/","key":"${{ inputs.cache-key != '' \u0026\u0026 inputs.cache-key || format( 'lxd-devstack-keystone-swift-2023.2-22.04-{0}{1}', inputs.network, inputs.s3api == 'true' \u0026\u0026 '-s3api' || '') }}"}},{"name":"Build Devstack Swift LXD Container","if":"inputs.use-cache != 'true' || steps.devstack-swift-cache.outputs.cache-hit != 'true'","shell":"bash","run":"lxc init ubuntu:22.04 devstack --project devstack\nlxc network attach lxdbrstack devstack eth0 eth0 --project devstack\nlxc config device set devstack eth0 ipv4.address ${{ steps.parse-network.outputs.devstack-ip }} --project devstack\nlxc start devstack --project devstack\necho waiting for initialization\ntimeout 120s bash -c 'until lxc exec devstack --project devstack -- bash -c \"[ -d /home/ubuntu ]\"; do sleep 1 \u0026\u0026 echo .; done; echo'\necho waiting for network\ntimeout 120s bash -c 'until lxc exec devstack --project devstack -- bash -c \"curl -sSL https://github.com/openstack/devstack.git -m 3 -o /dev/null\"; do sleep 1; done; echo'\nlxc exec devstack --user 1000 --cwd /home/ubuntu --project devstack -- git clone -b unmaintained/2023.1 https://github.com/openstack/devstack.git\nlxc exec devstack --user 1000 --cwd /home/ubuntu --project devstack -- cp ./devstack/samples/local.conf ./devstack\nlxc exec devstack --user 1000 --cwd /home/ubuntu --project devstack -- sh -c \"echo disable_all_services \u003e\u003e ./devstack/local.conf\"\nlxc exec devstack --user 1000 --cwd /home/ubuntu --project devstack -- sh -c \"echo enable_service key mysql s-proxy s-object s-container s-account \u003e\u003e ./devstack/local.conf\"\n[ ${{ inputs.s3api }} = true ] \u0026\u0026 lxc exec devstack --user 1000 --cwd /home/ubuntu --project devstack -- sh -c \"echo enable_service s3api \u003e\u003e ./devstack/local.conf\"\nlxc exec devstack --user 1000 --cwd /home/ubuntu --project devstack -- sh -c \"echo ENABLE_KSM=False \u003e\u003e ./devstack/local.conf\"\nlxc exec devstack --cwd /home/ubuntu/devstack --project devstack -- sudo --login --user ubuntu /home/ubuntu/devstack/stack.sh\nlxc exec devstack --project devstack -- sh -c \"echo \u003e /etc/fstab\"\n"},{"name":"Generate Devstack Image Snapshot","if":"inputs.use-cache == 'true' \u0026\u0026 steps.devstack-swift-cache.outputs.cache-hit != 'true'","shell":"bash","run":"mkdir .devstack\ncd .devstack\nlxc stop devstack --project devstack\nlxc snapshot devstack devstack-snapshot --project devstack\nlxc publish devstack/devstack-snapshot --alias devstack-swift --project devstack\nlxc image export devstack-swift devstack-swift --project devstack\nlxc image delete devstack-swift --project devstack\nlxc start devstack --project devstack\n"},{"name":"Resume Devstack Swift Image From Tarball","if":"inputs.use-cache == 'true' \u0026\u0026 steps.devstack-swift-cache.outputs.cache-hit == 'true'","shell":"bash","run":"cd .devstack\nlxc image import devstack-swift.tar.gz --alias devstack-swift --project devstack\nlxc init devstack-swift devstack --project devstack\nlxc network attach lxdbrstack devstack eth0 eth0 --project devstack\nlxc config device set devstack eth0 ipv4.address ${{ steps.parse-network.outputs.devstack-ip }} --project devstack\nlxc start devstack --project devstack\n"},{"name":"Create Credentials","shell":"bash","run":"timeout 120s bash -c \"until [[ \\$(lxc list -c4 --format csv devstack --project devstack) ]]; do sleep 1 \u0026\u0026 echo .; done; echo\"\nlxc exec devstack --project devstack -- bash -c \". /home/ubuntu/devstack/openrc \u0026\u003e /dev/null \u0026\u0026 printenv | grep OS_ | grep -v OS_AUTH_URL | sed 's/^/export /g'\" \u003e credentials\necho \"export OS_AUTH_URL=http://$(lxc list -c4 --format csv devstack --project devstack | cut -d' ' -f1)/identity\" \u003e\u003e credentials\ncat credentials\n"},{"name":"Ensure Devstack Running","shell":"bash","run":". credentials\nWAIT=0\nuntil [ $WAIT -eq 10 ] || curl -sf $OS_AUTH_URL -o /dev/null --max-time 1; do\n    echo .\n    sleep $(( WAIT++ ))\ndone\n[ $WAIT -lt 10 ]\n"},{"name":"Convert Credentials to S3 Style","if":"inputs.s3api == 'true'","shell":"python","run":"import os\nimport re\nimport json\nimport posixpath\nimport subprocess\nimport configparser\nimport urllib.request\n\nrc_parser = configparser.ConfigParser()\nrc_parser.optionxform = str\nrc_file = open(\"credentials\").read()\nrc_file = re.sub(\"^export \", \"\", rc_file, flags=re.MULTILINE)\nrc_parser.read_string(\"[default]\\n\" + rc_file)\nos.environ.update(rc_parser[\"default\"])\n\nauth_url = posixpath.join(os.getenv(\"OS_AUTH_URL\"), \"v3/auth/tokens\")\nresponse = urllib.request.urlopen(urllib.request.Request(\n    url=auth_url,\n    method=\"POST\",\n    data=json.dumps(\n        {\n            \"auth\": {\n                \"identity\": {\n                    \"methods\": [\"password\"],\n                    \"password\": {\n                        \"user\": {\n                            \"name\": os.getenv(\"OS_USERNAME\"),\n                            \"domain\": {\"id\": os.getenv(\"OS_USER_DOMAIN_ID\")},\n                            \"password\": os.getenv(\"OS_PASSWORD\")\n                        }\n                    }\n                },\n                \"scope\": {\n                    \"project\": {\n                        \"name\": os.getenv(\"OS_PROJECT_NAME\"),\n                        \"domain\": {\"id\": os.getenv(\"OS_PROJECT_DOMAIN_ID\")}\n                    }\n                }\n            }\n        }).encode(),\n    headers={\"Content-Type\": \"application/json\"}\n))\n\nwith response as f:\n    token = json.loads(f.read().decode())\nswift_service = [\n    service for service in token[\"token\"][\"catalog\"]\n    if service[\"name\"] == \"swift\"\n][0]\nswift_endpoint = [\n    endpoint[\"url\"] for endpoint in swift_service[\"endpoints\"]\n    if endpoint[\"interface\"] == \"admin\"\n][0]\nec2_credential_create_cmd = [\n    \"lxc\", \"exec\", \"devstack\", \"--project\", \"devstack\", \"--\",\n    \"bash\", \"-c\",\n    \". /home/ubuntu/devstack/openrc \u0026\u003e /dev/null \u0026\u0026 openstack ec2 credentials create -f json\"\n]\nec2_credential = json.loads(subprocess.check_output(ec2_credential_create_cmd))\ncredentials = [\n    \"[default]\",\n    f\"aws_access_key_id = {ec2_credential['access']}\",\n    f\"aws_secret_access_key = {ec2_credential['secret']}\",\n    f\"endpoint_url = {swift_endpoint}\"\n]\ncredentials = \"\\n\".join(credentials)\nwith open(\"credentials\", \"w+\") as f:\n    f.write(credentials)\nprint(credentials)\n"},{"name":"Output Credentials","id":"output-credentials","shell":"bash","run":"echo \"credentials\u003c\u003cEOF\" \u003e\u003e $GITHUB_OUTPUT\nsed -e '$a\\' credentials \u003e\u003e $GITHUB_OUTPUT\necho \"EOF\" \u003e\u003e $GITHUB_OUTPUT\nrm credentials\n"}]},"default_branch":"main","path":null},"repo_metadata":{"id":66131880,"uuid":"541669864","full_name":"canonical/setup-devstack-swift","owner":"canonical","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-07T10:34:47.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-23T23:36:35.503Z","etag":null,"topics":["action","platform-engineering"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canonical.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-09-26T16:03:00.000Z","updated_at":"2025-03-18T08:57:45.000Z","dependencies_parsed_at":"2024-03-04T18:42:44.483Z","dependency_job_id":null,"html_url":"https://github.com/canonical/setup-devstack-swift","commit_stats":null,"previous_names":["weiiwang01/setup-devstack-swift"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/canonical/setup-devstack-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canonical","download_url":"https://codeload.github.com/canonical/setup-devstack-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261842261,"owners_count":23217932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"},"owner_record":{"login":"canonical","name":"Canonical","uuid":"53057619","kind":"organization","description":"","email":null,"website":"https://canonical.com","location":"London, UK","twitter":"Canonical","company":null,"icon_url":"https://avatars.githubusercontent.com/u/53057619?v=4","repositories_count":1802,"last_synced_at":"2025-05-25T12:10:16.367Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/canonical","funding_links":[],"total_stars":49667,"followers":2603,"following":0,"created_at":"2022-11-02T16:31:02.954Z","updated_at":"2025-05-25T12:10:16.368Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canonical","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canonical/repositories"},"tags":[{"name":"v1","sha":"f549dc28ff12e329c3cf6cc60f71789e9aaf8604","kind":"commit","published_at":"2023-02-16T02:00:14.000Z","download_url":"https://codeload.github.com/canonical/setup-devstack-swift/tar.gz/v1","html_url":"https://github.com/canonical/setup-devstack-swift/releases/tag/v1","dependencies_parsed_at":"2023-06-06T02:03:55.466Z","dependency_job_id":null,"purl":"pkg:github/canonical/setup-devstack-swift@v1","tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift/tags/v1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canonical%2Fsetup-devstack-swift/tags/v1/manifests"}]},"repo_metadata_updated_at":"2025-06-25T10:20:48.734Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":42.858974907023466,"dependent_packages_count":0.0,"stargazers_count":49.38656863164194,"forks_count":37.2590091052879,"average":32.376138160988326},"purl":"pkg:githubactions/weiiwang01/setup-devstack-swift","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/actions/weiiwang01/setup-devstack-swift","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/actions/weiiwang01/setup-devstack-swift","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/actions/weiiwang01/setup-devstack-swift/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/weiiwang01%2Fsetup-devstack-swift/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/weiiwang01%2Fsetup-devstack-swift/version_numbers","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/weiiwang01%2Fsetup-devstack-swift/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/weiiwang01%2Fsetup-devstack-swift/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/weiiwang01%2Fsetup-devstack-swift/codemeta","maintainers":[]}