-
Notifications
You must be signed in to change notification settings - Fork 122
Install go, tools, and dependencies for Copilot #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: "Copilot Setup Steps" | ||
|
||
# Automatically run the setup steps when they are changed to allow for easy validation, and | ||
# allow manual testing through the repository's "Actions" tab | ||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- .github/workflows/copilot-setup-steps.yml | ||
pull_request: | ||
paths: | ||
- .github/workflows/copilot-setup-steps.yml | ||
|
||
jobs: | ||
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | ||
copilot-setup-steps: | ||
runs-on: ubuntu-latest | ||
|
||
# Set the permissions to the lowest permissions possible needed for your steps. | ||
# Copilot will be given its own token for its operations. | ||
permissions: | ||
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. | ||
contents: read | ||
env: | ||
ELASTICSEARCH_ENDPOINTS: "http://localhost:9200" | ||
ELASTICSEARCH_USERNAME: "elastic" | ||
ELASTICSEARCH_PASSWORD: password | ||
KIBANA_ENDPOINT: "http://localhost:5601" | ||
KIBANA_USERNAME: "elastic" | ||
KIBANA_PASSWORD: password | ||
KIBANA_SYSTEM_USERNAME: kibana_system | ||
KIBANA_SYSTEM_PASSWORD: password | ||
TF_ACC: "1" | ||
services: | ||
elasticsearch: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.3 | ||
env: | ||
discovery.type: single-node | ||
xpack.security.enabled: true | ||
xpack.security.authc.api_key.enabled: true | ||
xpack.security.authc.token.enabled: true | ||
xpack.watcher.enabled: true | ||
xpack.license.self_generated.type: trial | ||
repositories.url.allowed_urls: https://example.com/* | ||
path.repo: /tmp | ||
ELASTIC_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }} | ||
ports: | ||
- 9200:9200 | ||
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10 | ||
kibana: | ||
image: docker.elastic.co/kibana/kibana:9.0.3 | ||
env: | ||
SERVER_NAME: kibana | ||
ELASTICSEARCH_HOSTS: http://elasticsearch:9200 | ||
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }} | ||
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }} | ||
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d | ||
# LOGGING_ROOT_LEVEL: debug | ||
ports: | ||
- 5601:5601 | ||
options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10 | ||
fleet: | ||
image: docker.elastic.co/elastic-agent/elastic-agent:9.0.3 | ||
env: | ||
SERVER_NAME: fleet | ||
FLEET_ENROLL: "1" | ||
FLEET_URL: https://fleet:8220 | ||
FLEET_INSECURE: "true" | ||
FLEET_SERVER_ENABLE: "1" | ||
FLEET_SERVER_POLICY_ID: fleet-server | ||
FLEET_SERVER_ELASTICSEARCH_HOST: http://elasticsearch:9200 | ||
FLEET_SERVER_ELASTICSEARCH_INSECURE: "true" | ||
FLEET_SERVER_INSECURE_HTTP: "true" | ||
KIBANA_HOST: http://kibana:5601 | ||
KIBANA_FLEET_SETUP: "1" | ||
KIBANA_FLEET_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }} | ||
ports: | ||
- 8220:8220 | ||
options: --restart="unless-stopped" | ||
|
||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3 | ||
with: | ||
terraform_wrapper: false | ||
|
||
- name: Get dependencies | ||
run: make setup | ||
|
||
- name: Setup Kibana user | ||
run: make set-kibana-password | ||
env: | ||
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }} | ||
KIBANA_SYSTEM_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }} | ||
KIBANA_SYSTEM_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }} | ||
|
||
- id: get-api-key | ||
name: Get ES API key | ||
run: |- | ||
echo "apikey=$(make create-es-api-key | jq -r .encoded)" >> "$GITHUB_OUTPUT" | ||
env: | ||
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }} | ||
|
||
- id: setup-fleet | ||
name: Setup Fleet | ||
run: |- | ||
make setup-kibana-fleet | ||
env: | ||
ELASTICSEARCH_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }} | ||
FLEET_NAME: "fleet" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to parameterize this somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT the only way to do that at this level is to configure a repo level variable, workflow level environment variables aren't accessible at this point (take a look at this result).
IMO having the stack version defined in some esoteric repo setting is way worse than duplicating it a couple of times within this single file 🤷.