Skip to content

Address 'User not authorized to access Ansible Lightspeed' when request is blocked by CloudFront #3070

Address 'User not authorized to access Ansible Lightspeed' when request is blocked by CloudFront

Address 'User not authorized to access Ansible Lightspeed' when request is blocked by CloudFront #3070

Workflow file for this run

# This is a basic workflow
name: ci
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: ["main", "devel/*"]
pull_request:
branches: ["main", "devel/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
FORCE_COLOR: "1" # make mocha output colorful
PRETTIER_LEGACY_CLI: "1" # https://github.com/prettier/prettier/issues/15832
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
# https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/
WSLENV: HOSTNAME:CI:FORCE_COLOR:GITHUB_ACTION:GITHUB_ACTION_PATH/p:GITHUB_ACTION_REPOSITORY:GITHUB_WORKFLOW:GITHUB_WORKSPACE/p:GITHUB_PATH/p
# We define a hostname because otherwise the variable might not always be accessible on runners.
HOSTNAME: gha
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: ${{ matrix.name }}
# ${{ matrix.name && matrix.name || format('{0} ({1})', matrix.task-name, matrix.os) }}
environment: ci # codecov needed
env:
SKIP_PODMAN: ${{ matrix.env.SKIP_PODMAN || 0 }}
SKIP_DOCKER: ${{ matrix.env.SKIP_DOCKER || 0 }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# see https://github.com/containers/podman/issues/13609
continue-on-error: ${{ contains(matrix.name, 'macos') && true || false }}
strategy:
fail-fast: false
matrix:
# Avoid letting github do the matrix multiplication and use manual
# includes for each job, this gives us fine control over job name.
continue-on-error:
- false
os:
- ubuntu-22.04
task-name:
- test
upload-artifact:
- false
name:
- test
include:
- name: lint
task-name: lint
os: ubuntu-22.04
upload-artifact: true
env:
SKIP_PODMAN: 1
SKIP_DOCKER: 1
- name: devel
# this job will install latest version of ansible-language-server
# instead of the one mentioned in lock file
task-name: devel
os: ubuntu-22.04
- name: test (macos)
task-name: test
os: macos-13-large
env:
SKIP_PODMAN: 1
SKIP_DOCKER: 1
# only until we fix some broken tests, as we need it to pass
# in order to enable the caching
continue-on-error: true
steps:
- name: Disable autocrlf
if: contains(matrix.os, 'windows')
run: |-
git config --global core.autocrlf false
git config --global core.eol lf
shell: bash # <-- keep it here to avoid using default shell
- uses: actions/checkout@v4
- name: Setup asdf
if: "!contains(matrix.shell, 'wsl')"
uses: asdf-vm/actions/install@v3
- name: Install asdf inside WSL
if: "contains(matrix.shell, 'wsl')"
run: |
set -ex
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
export ASDF_DIR="$HOME/.asdf"
. "$HOME/.asdf/asdf.sh"
asdf plugin add nodejs
asdf plugin add python
asdf plugin add task
asdf plugin add yarn
asdf install
asdf info
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Enable caching
uses: actions/cache@v4
with:
path: |
.vscode-test
.yarn/cache
out/ext
out/test-resources
out/test-resources-oldest
~/.cache/pip
~/.cache/yarn
~/.cache/pre-commit/
key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/requirements.txt', 'tools/*.*') }}
# - name: Enable caching for podman-machine
# if: "contains(matrix.os, 'macos')"
# uses: actions/cache@v4
# with:
# path: |
# ~/.local/share/containers
# ~/.config/containers
# key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/requirements.txt', '**/Taskfile.yml', 'tools/*.*') }}
- name: task setup
# starting podman machine can randomly get stuck on macos
timeout-minutes: 20
run: task setup
## uncomment to debug on GHA runner
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: task package
run: task package --output=group --output-group-begin='::group::{{.TASK}}' --output-group-end='::endgroup::'
- name: task ${{ matrix.task-name }}
env:
# For using the mock Lightspeed server.
TEST_LIGHTSPEED_ACCESS_TOKEN: "dummy"
# The mock server runs on localhost. However, just using "localhost" as the hostname causes a few issues in
# GitHub Actions environment:
#
# On Linux: When "localhost" is used as the hostname, the mock server uses the ipv6 loopback address [::1] . However,
# the axios library, which is used in the extension tries to access to the ipv4 loopback 127.0.0.1 when "localhost"
# is specified and the axios library does not support URLs that contains ipv6 addresses, e.g. http://[::1]:3000.
# Also, If 127.0.0.1 is specified for the mock server, the server fails to start. Those issues are resolved by
# using the special ipv6-only hostname "ip6-localhost", which is available in GitHub Actions Linux environment.
#
# On MacOS: The hostname "ip6-localhost" is not available. However, 127.0.0.1 can be used for starting the mock
# server on MacOS and the axios library can connect to that address. So we can use 127.0.0.1 for MacOS.
#
# Once the axios library starts supporting URLs that contain ipv6 addresses, we will be able to use
# http://[::1]:3000 both on Linux and MacOS to get rid of the following conditional statement.
TEST_LIGHTSPEED_URL: "${{ contains(matrix.name, 'macos') && 'http://127.0.0.1:3000' || 'http://ip6-localhost:3000' }}"
# Set environment variables using matrix properties.
SKIP_PODMAN: "${{ matrix.env.SKIP_PODMAN || '0' }}"
SKIP_DOCKER: "${{ matrix.env.SKIP_DOCKER || '0' }}"
# For using an actual Lightspeed server instance, uncomment following two lines.
# TEST_LIGHTSPEED_ACCESS_TOKEN: ${{ secrets.TEST_LIGHTSPEED_ACCESS_TOKEN }}
# TEST_LIGHTSPEED_URL: ${{ secrets.TEST_LIGHTSPEED_URL }}
run: task ${{ matrix.task-name }} --output=group --output-group-begin='::group::{{.TASK}}' --output-group-end='::endgroup::'
- name: Upload coverage data
if: ${{ startsWith(matrix.name, 'test') }}
uses: codecov/codecov-action@v4
with:
name: ${{ matrix.name }}
token: ${{ secrets.CODECOV_TOKEN }}
files: out/coverage/lcov.info
flags: unit
fail_ci_if_error: true
- name: Upload vsix artifact
if: ${{ github.event.number && matrix.upload-artifact }}
uses: actions/upload-artifact@v4
with:
name: ansible-extension-from-pr-${{ github.event.number }}.vsix
path: ansible-*.vsix
retention-days: 15
- name: Upload test logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.os }}-${{ matrix.task-name }}.zip
path: |
out/e2eTestReport
out/log
out/test-resources/settings/logs
out/userdata/logs
if-no-files-found: ignore
retention-days: 15
- name: Stop services
if: "contains(matrix.os, 'macos')"
# Stopping podman machine is needed or caching it will fail
run: |
command -v podman && {
podman machine stop
while [[ "$(podman machine ls --format '{{.Running}}' \
--noheading || true)" != "false" ]]; do
sleep 1
echo -n .
done
echo .
}
continue-on-error: true
## commented out for future use to debug on the GHA node if required
# - name: Setup tmate session
# if: ${{ always() }}
# uses: mxschmitt/action-tmate@v3
check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- build
runs-on: ubuntu-22.04
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}