4 # yamllint disable-line rule:truthy
9 description: "Branch that change is against"
13 description: "The ID for the change"
17 description: "The Gerrit number"
21 description: "URL to the change"
25 description: "Type of Gerrit event"
28 GERRIT_PATCHSET_NUMBER:
29 description: "The patch number for the change"
32 GERRIT_PATCHSET_REVISION:
33 description: "The revision sha"
37 description: "Project in Gerrit"
41 description: "Gerrit refspec of change"
46 PACKER_VERSION: "1.8.6"
49 group: ${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
50 cancel-in-progress: true
54 runs-on: ubuntu-latest
57 uses: lfit/gerrit-review-action@v0.3
59 host: ${{ vars.GERRIT_SERVER }}
60 username: ${{ vars.GERRIT_SSH_USER }}
61 key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
62 known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
63 gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
64 gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
66 - name: Allow replication
71 runs-on: ubuntu-latest
73 - uses: lfit/checkout-gerrit-change-action@v0.3
75 gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
77 - name: Download actionlint
79 run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
81 - name: Check workflow files
82 run: ${{ steps.get_actionlint.outputs.executable }} -color
85 # run pre-commit tox env separately to get use of more parallel processing
88 runs-on: ubuntu-latest
90 - uses: lfit/checkout-gerrit-change-action@v0.3
92 gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
94 - uses: actions/setup-python@v4
96 python-version: "3.11"
97 - name: Run static analysis and format checkers
98 run: pipx run pre-commit run --all-files --show-diff-on-failure
102 runs-on: ubuntu-latest
104 - uses: lfit/checkout-gerrit-change-action@v0.3
106 gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
108 - uses: actions/setup-python@v4
111 python-version: "3.11"
112 - name: Clone git submodules
113 run: git submodule update --init
114 - name: Run JJB Verify
116 python -m pip install --upgrade pip
117 pip install jenkins-job-builder
118 mkdir -p "${HOME}/.config/jenkins_jobs"
119 cat << EOF > "${HOME}/.config/jenkins_jobs/jenkins_jobs.ini"
122 keep_descriptions=False
125 query_plugins_info=False
128 jenkins-jobs test -o archives/job-configs jjb/
132 runs-on: ubuntu-latest
134 - uses: lfit/checkout-gerrit-change-action@v0.3
136 gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
138 - uses: actions/setup-python@v4
141 python-version: "3.11"
148 runs-on: ubuntu-latest
150 - uses: lfit/checkout-gerrit-change-action@v0.3
152 gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
155 uses: hashicorp/setup-packer@main
158 AUTH_URL: ${{ secrets.cloud_auth_url }}
159 CLOUD_ENV: "packer/cloud-env.json"
161 cloud_auth_url: "https://auth.vexxhost.net/v3/"
162 cloud_tenant: ${{ secrets.cloud_tenant }}
163 cloud_user: ${{ secrets.cloud_user }}
164 cloud_network: ${{ secrets.cloud_network }}
165 version: ${{ env.PACKER_VERSION }}
166 cloud_pass: ${{ secrets.cloud_pass }}
168 file_name: cloud-env.json
170 - name: Clone git submodules
171 run: git submodule update --init
172 - uses: dorny/paths-filter@v2
178 - if: steps.changes.outputs.src == 'true'
181 varfiles=(vars/*.json common-packer/vars/*.json)
182 templates=(templates/*.json)
184 for varfile in "${varfiles[@]}"; do
185 # cloud-env.json is a file containing credentials which is pulled in via
186 # CLOUDENV variable so skip it here. Also handle the case where a project
187 # has not vars/*.json file.
188 if [[ "$varfile" == *"cloud-env.json"* ]] || [[ "$varfile" == 'vars/*.json' ]]; then
192 echo "-----> Testing varfile: $varfile"
193 for template in "${templates[@]}"; do
194 export PACKER_LOG="yes"
195 export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log"
196 if output=$(packer validate -var-file="$CLOUDENV" -var-file="$varfile" "$template"); then
197 echo "$template: $output"
199 echo "$template: $output"
216 runs-on: ubuntu-latest
218 - uses: technote-space/workflow-conclusion-action@v3
220 uses: lfit/gerrit-review-action@v0.3
222 host: ${{ vars.GERRIT_SERVER }}
223 username: ${{ vars.GERRIT_SSH_USER }}
224 key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
225 known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
226 gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
227 gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
228 vote-type: ${{ env.WORKFLOW_CONCLUSION }}