Skip to content

Commit 99c106f

Browse files
authored
(SIMP-10450) GHA: Update ubuntu-16.04 to latest (#14)
GitHub actions' Ubuntu 16.04 environment will be removed on Sept 20, 2021. This patch migrates all workflow using the `ubuntu-16.04` environment to `ubuntu-latest`. The patch enforces a standardized asset baseline using simp/puppetsync, and may apply other updates to ensure conformity. [SIMP-10473] #close [SIMP-10450] #comment Add `release_rpms` to pupmod-simp-ds389
1 parent f15584a commit 99c106f

File tree

6 files changed

+27
-24
lines changed

6 files changed

+27
-24
lines changed

.github/workflows/pr_glci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# we restrict ourselves to sending data elsewhere.
6464
glci-syntax:
6565
name: '.gitlab-ci.yml Syntax'
66-
runs-on: ubuntu-16.04
66+
runs-on: ubuntu-latest
6767
outputs:
6868
valid: ${{ steps.validate-glci-file.outputs.valid }}
6969
steps:
@@ -174,7 +174,7 @@ jobs:
174174
### examine_contexts:
175175
### name: 'Examine Context contents'
176176
### if: always()
177-
### runs-on: ubuntu-16.04
177+
### runs-on: ubuntu-latest
178178
### needs: [ glci-syntax, contributor-permissions ]
179179
### steps:
180180
### - name: Dump contexts

.github/workflows/pr_glci_cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
### examine_contexts:
9494
### name: 'Examine Context contents'
9595
### if: always()
96-
### runs-on: ubuntu-16.04
96+
### runs-on: ubuntu-latest
9797
### steps:
9898
### - name: Dump contexts
9999
### env:

.github/workflows/pr_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129

130130
# dump_contexts:
131131
# name: 'Examine Context contents'
132-
# runs-on: ubuntu-16.04
132+
# runs-on: ubuntu-latest
133133
# steps:
134134
# - name: Dump contexts
135135
# env:

.github/workflows/release_rpms.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ jobs:
101101
const [owner, repo] = process.env.TARGET_REPO.split('/')
102102
const tag = process.env.RELEASE_TAG
103103
const autocreate_release = (process.env.AUTOCREATE_RELEASE == 'yes')
104-
var release_id
105104
const owner_data = { owner: owner, repo: repo }
106105
const release_data = Object.assign( {tag: tag}, owner_data )
107106
const create_release_data = Object.assign( {tag_name: tag}, owner_data )
108107
const tag_data = Object.assign( {ref: `tags/${tag}`}, owner_data )
109108
110109
function id_from_release(data) {
111-
console.log( `>> Release for ${owner}/${repo}, tag ${tag}` )
112-
console.log( `>>>> release_id: ${data.id}` )
113-
return(data.id)
110+
console.log( ` >> Release for ${owner}/${repo}, tag ${tag}` )
111+
console.log( ` >>>> release_id: ${data.id}` )
112+
return data.id
114113
}
115114
116115
function throw_error_unless_should_autocreate_release(err){
@@ -124,38 +123,41 @@ jobs:
124123
throw_error_unless_should_autocreate_release(err)
125124
core.warning(`Can't find release for tag ${tag} and tag exists, auto-creating release`)
126125
127-
// Must already have a tag
128-
github.request( 'GET /repos/{owner}/{repo}/git/matching-refs/{ref}', tag_data ).then (
126+
return await github.request( 'GET /repos/{owner}/{repo}/git/matching-refs/{ref}', tag_data ).then (
129127
result => {
128+
// Must already have a tag
130129
if (result.data.length == 0) { throw `Can't find tag ${tag} in repo ${owner}/${repo}` }
130+
return result
131131
}
132132
).then(
133-
result => {
134-
github.request( 'POST /repos/{owner}/{repo}/releases', create_release_data).then(
133+
async result => {
134+
return await github.request( 'POST /repos/{owner}/{repo}/releases', create_release_data).then(
135135
result=>{
136136
release_id = id_from_release(result.data)
137+
console.log(` ++ created auto release ${release_id}` )
138+
return release_id
137139
},
138140
post_err =>{
139141
core.error('Error auto-creating release')
140142
throw post_err
141143
}
142144
)
143145
}
144-
).finally(()=>{
145-
return(release_id)
146-
})
146+
)
147147
}
148148
149-
github.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', release_data ).then(
150-
result => { release_id = id_from_release(result.data) },
151-
err => { release_id = autocreate_release_if_appropriate(err) }
152-
).catch( e => { throw e } ).then(
153-
result => {
149+
await github.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', release_data ).then(
150+
async result => { return await id_from_release(result.data) },
151+
async err => { return await autocreate_release_if_appropriate(err) }
152+
).then(
153+
release_id => {
154154
if (!release_id){
155155
throw `Could not get release for ${tag} for repo ${owner}:${repo}`
156156
}
157+
console.log( ` **** release_id: ${release_id}` )
157158
core.setOutput('id', release_id)
158-
}
159+
},
160+
err => { throw err }
159161
)
160162
161163
- name: Checkout code

.github/workflows/tag_deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#
2727
# * The CHANGLOG text is altered to remove RPM-style date headers, which don't
2828
# render well as markdown on the GitHub release pages
29+
#
2930
---
3031
name: 'Tag: Release to GitHub & Puppet Forge'
3132

.github/workflows/validate_tokens.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
jobs:
3030
puppetforge:
3131
name: 'Puppet Forge token authenticates with API'
32-
runs-on: ubuntu-16.04
32+
runs-on: ubuntu-latest
3333
env:
3434
PUPPETFORGE_API_TOKEN: ${{ secrets.PUPPETFORGE_API_TOKEN }}
3535
FORGE_USER_AGENT: GitHubActions-ForgeReleng-Workflow/0.4.0 (Purpose/forge-ops-for-${{ github.event.repository.name }})
@@ -42,7 +42,7 @@ jobs:
4242
4343
gitlab:
4444
name: 'GitLab token has scope for developer'
45-
runs-on: ubuntu-16.04
45+
runs-on: ubuntu-latest
4646
env:
4747
GITLAB_API_PRIVATE_TOKEN: ${{ secrets.GITLAB_API_PRIVATE_TOKEN }}
4848
GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }}
@@ -57,7 +57,7 @@ jobs:
5757
5858
github-no-scope:
5959
name: 'No-scope GitHub token has NO scopes'
60-
runs-on: ubuntu-16.04
60+
runs-on: ubuntu-latest
6161
env:
6262
GITHUB_ORG: ${{ github.event.organization.login }}
6363
NO_SCOPE_GITHUB_TOKEN: ${{secrets.NO_SCOPE_GITHUB_TOKEN}}

0 commit comments

Comments
 (0)