66 description : ' List of branches to lock versions (ordered, comma separated)'
77 required : true
88 # 7.17 was intentionally skipped because it was added late and was bug fix only
9- default : ' 8.18,8. 19,9.0,9.1'
9+ default : ' 8.19,9.0,9.1,9.2 '
1010
1111jobs :
1212 pr :
1313 runs-on : ubuntu-latest
1414
1515 steps :
1616 - name : Validate the source branch
17- uses : actions/github-script@v3
17+ uses : actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3
1818 with :
1919 script : |
2020 if ('refs/heads/main' !== '${{github.event.ref}}') {
2121 core.setFailed('Forbidden branch, expected "main"')
2222 }
2323
2424 - name : Checkout detection-rules
25- uses : actions/checkout@v4
25+ uses : actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
2626 with :
2727 fetch-depth : 0
2828
2929 - name : Set up Python 3.12
30- uses : actions/setup-python@v5
30+ uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3131 with :
3232 python-version : ' 3.12'
3333
3737 pip cache purge
3838 pip install .[dev]
3939
40+ - name : Check out container repository
41+ env :
42+ DR_CLOUD_ID : ${{ secrets.dr_cloud_id }}
43+ DR_API_KEY : ${{ secrets.dr_api_key }}
44+ if : ${{ !env.DR_CLOUD_ID && !env.DR_API_KEY }}
45+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
46+ with :
47+ path : elastic-container
48+ repository : peasead/elastic-container
49+
50+ - name : Build and run containers
51+ env :
52+ DR_CLOUD_ID : ${{ secrets.dr_cloud_id }}
53+ DR_API_KEY : ${{ secrets.dr_api_key }}
54+ if : ${{ !env.DR_CLOUD_ID && !env.DR_API_KEY }}
55+ run : |
56+ cd elastic-container
57+ GENERATED_PASSWORD=$(openssl rand -base64 16)
58+ sed -i "s|changeme|$GENERATED_PASSWORD|" .env
59+ echo "::add-mask::$GENERATED_PASSWORD"
60+ echo "GENERATED_PASSWORD=$GENERATED_PASSWORD" >> $GITHUB_ENV
61+ set -x
62+ bash elastic-container.sh start
63+
64+ - name : Get API Key and setup auth
65+ env :
66+ DR_CLOUD_ID : ${{ secrets.dr_cloud_id }}
67+ DR_API_KEY : ${{ secrets.dr_api_key }}
68+ DR_ELASTICSEARCH_URL : " https://localhost:9200"
69+ ES_USER : " elastic"
70+ ES_PASSWORD : ${{ env.GENERATED_PASSWORD }}
71+ if : ${{ !env.DR_CLOUD_ID && !env.DR_API_KEY }}
72+ run : |
73+ cd detection-rules
74+ response=$(curl -k -X POST -u "$ES_USER:$ES_PASSWORD" -H "Content-Type: application/json" -d '{
75+ "name": "tmp-api-key",
76+ "expiration": "1d"
77+ }' "$DR_ELASTICSEARCH_URL/_security/api_key")
78+
79+ DR_API_KEY=$(echo "$response" | jq -r '.encoded')
80+ echo "::add-mask::$DR_API_KEY"
81+ echo "DR_API_KEY=$DR_API_KEY" >> $GITHUB_ENV
82+
4083 - name : Build release package with navigator files
84+ env :
85+ DR_REMOTE_ESQL_VALIDATION : " true"
86+ DR_CLOUD_ID : ${{ secrets.dr_cloud_id || '' }}
87+ DR_KIBANA_URL : ${{ secrets.dr_cloud_id == '' && 'https://localhost:5601' || '' }}
88+ DR_ELASTICSEARCH_URL : ${{ secrets.dr_cloud_id == '' && 'https://localhost:9200' || '' }}
89+ DR_API_KEY : ${{ secrets.dr_api_key || env.DR_API_KEY }}
90+ DR_IGNORE_SSL_ERRORS : ${{ secrets.dr_cloud_id == '' && 'true' || '' }}
4191 run : |
4292 python -m detection_rules dev build-release --generate-navigator
4393
@@ -56,13 +106,19 @@ jobs:
56106 - name : Lock the versions
57107 env :
58108 BRANCHES : " ${{github.event.inputs.branches}}"
109+ DR_REMOTE_ESQL_VALIDATION : " true"
110+ DR_CLOUD_ID : ${{ secrets.dr_cloud_id || '' }}
111+ DR_KIBANA_URL : ${{ secrets.dr_cloud_id == '' && 'https://localhost:5601' || '' }}
112+ DR_ELASTICSEARCH_URL : ${{ secrets.dr_cloud_id == '' && 'https://localhost:9200' || '' }}
113+ DR_API_KEY : ${{ secrets.dr_api_key || env.DR_API_KEY }}
114+ DR_IGNORE_SSL_ERRORS : ${{ secrets.dr_cloud_id == '' && 'true' || '' }}
59115 run : |
60116 ./detection_rules/etc/lock-multiple.sh $BRANCHES
61117 git add detection_rules/etc/version.lock.json
62118
63119 - name : Create Pull Request
64120 id : cpr
65- uses : peter-evans/create-pull-request@v3
121+ uses : peter-evans/create-pull-request@18f7dc018cc2cd597073088f7c7591b9d1c02672 # v3
66122 with :
67123 assignees : ' ${{github.actor}}'
68124 delete-branch : true
78134 labels : " backport: auto"
79135
80136 - name : Archive production artifacts
81- uses : actions/upload-artifact@v4
137+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
82138 with :
83139 name : release-files
84140 path : |
0 commit comments